New unit_test framework:

* Header-only!
* No external dependencies or other beast modules
* Compilation options allow for:
  - Stand-alone application to run a single test suite
  - Stand-alone application to run a set of test suites
  - Global suite of tests inline with the host application
  - Disable test suite generation completely
* Existing tests reworked to use the new classes
This commit is contained in:
Vinnie Falco
2014-03-20 17:25:39 -07:00
parent 0bb6171a85
commit f63cf33118
114 changed files with 3259 additions and 4312 deletions

View File

@@ -17,6 +17,9 @@
*/
//==============================================================================
#include "../Debug.h"
#include "../../unit_test/suite.h"
namespace beast {
namespace Debug {
@@ -299,7 +302,7 @@ String commandLineToString (const String& commandLine)
// A simple unit test to determine the diagnostic settings in a build.
//
class DebugTests : public UnitTest
class Debug_test : public unit_test::suite
{
public:
static int envDebug ()
@@ -329,25 +332,34 @@ public:
#endif
}
void runTest ()
void run ()
{
beginTestCase ("diagnostics");
log <<
"operatingSystemName = '" <<
SystemStats::getOperatingSystemName () << "'";
log <<
"_DEBUG = " <<
String::fromNumber (envDebug ());
log <<
"BEAST_DEBUG = " <<
String::fromNumber (beastDebug ());
log <<
"BEAST_FORCE_DEBUG = " <<
String::fromNumber (beastForceDebug ());
log <<
"sizeof(std::size_t) = " <<
String::fromNumber (sizeof(std::size_t));
logMessage ("operatingSystemName = '" + SystemStats::getOperatingSystemName () + "'");
logMessage ("_DEBUG = " + String::fromNumber (envDebug ()));
logMessage ("BEAST_DEBUG = " + String::fromNumber (beastDebug ()));
logMessage ("BEAST_FORCE_DEBUG = " + String::fromNumber (beastForceDebug ()));
logMessage ("sizeof(std::size_t) = " + String::fromNumber (sizeof(std::size_t)));
bassertfalse;
fail ();
}
DebugTests () : UnitTest ("Debug", "beast", runManual)
{
}
};
static DebugTests debugTests;
BEAST_DEFINE_TESTSUITE_MANUAL(Debug,utility,beast);
}