Example Main
#include "UnitTestHarness/CommandLineTestRunner.h"
int main(int ac, char** av)
{
return CommandLineTestRunner::RunAllTests(ac, av);
}
Example Test File for a C++ class
#include "UnitTestHarness/TestHarness.h"
#include "ClassName.h"
TEST_GROUP(ClassName)
{
ClassName* className;
void setup()
{
className = new ClassName();
}
void teardown()
{
delete className;
}
};
TEST(ClassName, TestCaseShowingAllAssertions)
{
CHECK(0 != className);
CHECK(true);
CHECK_EQUAL(1,1);
LONGS_EQUAL(1,1);
BYTES_EQUAL(1,1);
DOUBLES_EQUAL(1.000, 1.001, .01);
STRCMP_EQUAL("hello", "hello");
FAIL("The prior tests pass, but this one doesn't");
}