27 using std::make_unique;
58 doIt (
const string cmdline)
60 cout <<
"Testing invocation with cmdline: " << cmdline <<
"..." << endl;
63 auto optparser = make_unique<TestOption>(args);
64 const string testID = optparser->getTestID();
65 cout <<
"--> Testgroup=" << optparser->getTestgroup() << endl;
66 cout <<
"--> Test-ID =" << (isnil(testID)?
"--missing--" : testID ) << endl;
67 cout <<
"--> remaining=" << args << endl;
68 return std::move (optparser);
71 void noOptions() {
doIt (
""); }
72 void help() {
doIt (
"--help"); }
73 void groupID() {
doIt (
"--group TestGroupID"); }
74 void singleTest() {
doIt (
" SingleTestID"); }
75 void groupFilter1() {
doIt (
" SingleTestID --group TestGroupID"); }
76 void groupFilter2() {
doIt (
" --group TestGroupID SingleTestID "); }
77 void additionalCmd() {
doIt (
" --group TestGroupID SingleTestID spam eggs"); }
78 void additionalCmd2() {
doIt (
"\t\tSingleTestID spam --group TestGroupID \t --eggs"); }
83 CHECK ( not
doIt(
"ham --group spam")->optSeed());
84 CHECK (7 == *
doIt(
"ham --seed 7 spam")->optSeed());
85 CHECK (0 == *
doIt(
"ham --seed 0 spam")->optSeed());
87 VERIFY_FAIL(
"argument (\'spam\') for option \'--seed\' is invalid" 88 ,
doIt(
"ham --seed spam"));
91 CHECK (std::numeric_limits<uint64_t>::max()
92 == *
doIt(
"--seed=-1")->optSeed());
invokes the TestOption parser for various example commandlines
Commandline options for our unittest test-suite executable.
Abstract Base Class for all testcases.
Simplistic test class runner.
Tiny helper functions and shortcuts to be used everywhere Consider this header to be effectively incl...
A collection of frequently used helper functions to support unit testing.
Abstraction of the usual int argc, int** argv-Commandline, to be able to treat it as a vector of stri...
auto doIt(const string cmdline)
#define VERIFY_FAIL(FAILURE_MSG, ERRONEOUS_STATEMENT)
Macro to verify that a statement indeed raises a std::exception, which additionally contains some FAI...