Jon Test
C++ Unit Test Tool. Not for production -- sample code only
Loading...
Searching...
No Matches
TestCaseOrder.cpp

std::cout demonstration of all tests in a suite being called, with setup() and teardown().

std::cout demonstration of all tests in a suite being called, with setup() and teardown().

#include <iostream>
int
main(
int argc,
char**argv
)
{
JonTest::StreamLogger logger(std::cout, true);
const JonTest::Count counts = JonTest::TestRunner::get().run(logger);
return counts.fails;
}
TEST_SUITE(SimpleTest)
void setup()
{
std::cout << "\t\t\tSimpleTest: setup()";
}
void teardown()
{
std::cout << " teardown()" << std::endl;
}
{
std::cout << " a()";
}
{
std::cout << " b()";
}
{
std::cout << " c()";
}
#define TEST_SUITE_END()
Finish definition of a Test Suite started with TEST_SUITE().
Definition TestSuite.h:77
#define TEST_CASE(testCaseName)
Defines a Test Case method named testCaseName within a Test Suite defined by TEST_SUITE().
Definition TestSuite.h:91
#define TEST_SUITE(testSuiteName)
Defines a Test Suite named testSuiteName.
Definition TestSuite.h:63
Count of tests run, and fails.
Definition Count.h:10
int fails
Number of tests that have failed.
Definition Count.h:18
Stream-based Logger for events while running tests.
Definition Logger.h:89
Count run(Logger &logger) const
Run all tests that have been add()ed.
static TestRunner & get()
Get the singleton.