1#ifndef TESTUTILS_CPPUNIT_H
2#define TESTUTILS_CPPUNIT_H
9#include <cppunit/TestPath.h>
10#include <cppunit/extensions/TestFactoryRegistry.h>
11#include <cppunit/ui/text/TestRunner.h>
17using namespace CPPUNIT_NS;
24 for (
int index = 0,
count =
test->getChildTestCount(); index !=
count; ++index) {
44 cerr <<
"Available tests:";
62 }
catch (
const invalid_argument &) {
67 cerr <<
"The following tests specified via --unit are not available:";
71 cerr <<
"\nAvailable tests:";
77 cerr << EscapeCodes::TextAttribute::Bold <<
"Executing test cases ..." << EscapeCodes::Phrases::EndFlush;
78 const auto ok =
runner.run(
string(),
false);
79 cerr << (
ok ?
"Tests successful\n" :
"Tests failed\n");
The Indentation class allows printing indentation conveniently, eg.
The TestApplication class simplifies writing test applications that require opening test files.
int main()
Sets the console up and launches the "main" application.
void printTestNames(Test *test, Indentation indentation)
Prints the names of all child tests of the specified test.
Contains all utilities provides by the c++utilities library.
IntegralType stringToNumber(const StringType &string, BaseType base=10)
Converts the given string to an unsigned/signed number assuming string uses the specified base.