A collection of helper functions, for writing simple unit tests. More...
#include <UnitTest.h>
Static Public Member Functions | |
static int | RunTests () |
Runs all unit tests in GXemul. More... | |
static void | Assert (const string &strFailMessage, bool condition) |
Asserts that a boolean condition is correct. More... | |
static void | Assert (const string &strFailMessage, uint64_t actualValue, uint64_t expectedValue) |
Asserts that two uint64_t values are equal. More... | |
static void | Assert (const string &strFailMessage, const string &actualValue, const string &expectedValue) |
Asserts that two string values are equal. More... | |
static void | Fail (const string &strMessage) |
Fails a unit test unconditionally, by throwing a UnitTestFailedException. More... | |
A collection of helper functions, for writing simple unit tests.
Definition at line 92 of file UnitTest.h.
|
static |
Asserts that a boolean condition is correct.
If the condition is not true, then Fail is called with the failure message.
The failure message can be something like "expected xyz", or "the list should be empty at this point".
strFailMessage | failure message to print to std::cerr |
condition | The result of some operation, which should be true. |
Definition at line 40 of file UnitTest.cc.
References Fail().
|
static |
Asserts that two string values are equal.
If the values are not equal, Fail is called with the failure message.
The failure message can be something like "expected xyz", or "the list should be empty at this point".
strFailMessage | Failure message to print to std::cerr. |
actualValue | The actual value. |
expectedValue | The expected value. |
Definition at line 61 of file UnitTest.cc.
References Fail().
|
static |
Asserts that two uint64_t values are equal.
If the values are not equal, Fail is called with the failure message.
The failure message can be something like "expected xyz", or "the list should be empty at this point".
strFailMessage | Failure message to print to std::cerr. |
actualValue | The actual value. |
expectedValue | The expected value. |
Definition at line 47 of file UnitTest.cc.
References Fail().
|
static |
Fails a unit test unconditionally, by throwing a UnitTestFailedException.
strMessage | failure message |
Definition at line 80 of file UnitTest.cc.
Referenced by Assert().
|
static |
Runs all unit tests in GXemul.
If WITHUNITTESTS was not defined in config.h, nothing is tested, and zero is returned.
Otherwise, unit tests for all classes that the configure
script detected as using UNITTESTS(classname) are executed.
If a test fails, the UNITTEST(testname) macro in the unit testing framework takes care of outputting a line identifying that test to std::cerr.
Definition at line 89 of file UnitTest.cc.
Referenced by internal_w().