UnitTest.h Source File
Back to the index.
Go to the documentation of this file.
40 :
public std::exception
44 : m_strMessage(strMessage)
129 static void Assert(
const string& strFailMessage,
bool condition);
143 static void Assert(
const string& strFailMessage,
144 uint64_t actualValue, uint64_t expectedValue);
158 static void Assert(
const string& strFailMessage,
159 const string& actualValue,
const string& expectedValue);
167 static void Fail(
const string& strMessage);
184 #define UNITTESTS(class) \
185 void class::RunUnitTests(int& nSucceeded, int& nFailures)
217 #define UNITTEST(functionname) try { \
218 std::cout << "### " #functionname "\n"; \
221 } catch (UnitTestFailedException& ex) { \
223 std::cerr << "\n### " #functionname " (" __FILE__ " line " \
224 << __LINE__ << ") failed!\n" \
225 " > " << ex.GetMessage() << "\n"; \
A collection of helper functions, for writing simple unit tests.
virtual ~UnitTestFailedException()
const string & GetMessage() const
Retrieves the error message associated with the exception.
UnitTestFailedException(const string &strMessage)
static void Assert(const string &strFailMessage, bool condition)
Asserts that a boolean condition is correct.
An exception thrown by unit test cases that fail.
Base class for unit testable classes.
static void Fail(const string &strMessage)
Fails a unit test unconditionally, by throwing a UnitTestFailedException.
static int RunTests()
Runs all unit tests in GXemul.
static void RunUnitTests(int &nSucceeded, int &nFailures)
Runs unit test cases.
Generated on Tue Aug 25 2020 19:25:06 for GXemul by
1.8.18