Free Electron
|
Counts success and failures in a style similar to assertions. More...
#include <UnitTest.h>
Public Member Functions | |
virtual void | operator() (bool success, const char *label="") |
Checks the "assertion" and log a message if it fails. More... | |
int | failures (void) |
Return the number of failures so far. More... | |
int | track (int expected) |
Compare the number of tests run to a reference. More... | |
Private Attributes | |
int | m_successes |
int | m_failures |
int | m_attempts |
Counts success and failures in a style similar to assertions.
Instantiating the object starts unit testing for the scope.
Upon destruction, a report is sent to the global logger.
The block contains any number of tests.
By convention, a stand-alone unit test executable should return the number of failures and the exit status.
For convenience a set of macros is provided:
|
inline |
Return the number of failures so far.
|
inlinevirtual |
Checks the "assertion" and log a message if it fails.
|
inline |
Compare the number of tests run to a reference.
Returns true if the numbers matched.