7 #define UNIT_START() fe::UnitTest unitTest; 8 #define UNIT_TEST(expression) unitTest(expression,#expression) 9 #define UNIT_TRACK(number) unitTest.track(number); 10 #define UNIT_RETURN() return unitTest.failures(); 69 feLogDirect(
"[31m\nResults: %d tests ",m_attempts);
72 feLogDirect(
"%d FAILED",m_failures);
76 feLogDirect(
"ALL PASSED");
78 feLogDirect(
"[0m\n\n");
81 virtual void operator()(
bool success,
const char *label=
"")
89 feLogDirect(
"[31mUnitTest(%s) failed[0m\n",label);
105 if(m_attempts!=expected)
107 feLogDirect(
"[31m\nWarning: Test count inconsistent!" 108 " Expected %d, but executed %d.",
109 expected,m_attempts);
113 feLogDirect(
"[0m\n");
kernel
Definition: namespace.dox:3
int track(int expected)
Compare the number of tests run to a reference.
Definition: UnitTest.h:101
virtual void operator()(bool success, const char *label="")
Checks the "assertion" and log a message if it fails.
Definition: UnitTest.h:81
Counts success and failures in a style similar to assertions.
Definition: UnitTest.h:56
int failures(void)
Return the number of failures so far.
Definition: UnitTest.h:96