Lumiera 0.pre.04
»edit your freedom«
Loading...
Searching...
No Matches
Suite Class Reference

#include "lib/test/suite.hpp"

Description

Enables running a collection of tests.

An internal registration service enrol() is provided for the individual Test - instances to be recognised as testcases. The groupID passed to the constructor selects all testcases declared as belonging to this Group.

Definition at line 59 of file suite.hpp.

Static Public Attributes

static const string ALLGROUP = "ALL"
 "magic" groupID containing all registered testcases
 
static const int TEST_OK = 0
 
static const int EXCEPTION_THROWN = 5
 exit code returned when any individual test threw
 

Static Public Member Functions

static void enrol (Launcher *test, string testID, string groups)
 register the given test-launcher, so it can be later accessed either as a member of one of the specified groups, or directly by its testID.
 

Public Member Functions

 Suite (string groupID, opt_uint64 seed)
 create a suite comprised of all the testcases previously registered with this this group.
 
bool run (Arg cmdline)
 run all testcases contained in this Suite.
 
void describe ()
 print to stdout an enumeration of all testcases in this suite, in a format suitable for use with Cehteh's .
 
int getExitCode () const
 

Private Attributes

string groupID_
 
int exitCode_
 

Constructor & Destructor Documentation

◆ Suite()

Suite ( string  groupID,
opt_uint64  optSeed 
)

create a suite comprised of all the testcases previously registered with this this group.

See also
run() running tests in a Suite

Definition at line 158 of file suite.cpp.

References SuiteSeedNucleus::fixedSeed, and Registry::getGroup().

+ Here is the call graph for this function:

Member Function Documentation

◆ run()

bool run ( Arg  cmdline)

run all testcases contained in this Suite.

The first argument in the commandline, if present, will select one single testcase with a matching ID. In case of invoking a single testcase, the given cmdline will be forwarded to the testcase, after removing the testcaseID from cmdline[0]. Otherwise, every testcase in this suite is invoked with a empty cmdline vector.

Parameters
cmdlineref to the vector of commandline tokens

Definition at line 251 of file suite.cpp.

References Suite::exitCode_, Registry::getGroup(), Suite::groupID_, and IS_VALID.

Referenced by main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ describe()

void describe ( )

print to stdout an enumeration of all testcases in this suite, in a format suitable for use with Cehteh's .

/test.sh

Todo:
this function war rarely used and is kind of broken by the fact that Nobug-assertions terminate the program instead of throwing, rendering the feature to integrate output mostly useless.

Definition at line 299 of file suite.cpp.

References Registry::getGroup(), Suite::groupID_, IS_VALID, and lumiera_error().

Referenced by main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getExitCode()

int getExitCode ( ) const

Definition at line 176 of file suite.cpp.

References Suite::exitCode_.

Referenced by main().

+ Here is the caller graph for this function:

◆ enrol()

void enrol ( Launcher test,
string  testID,
string  groups 
)
static

register the given test-launcher, so it can be later accessed either as a member of one of the specified groups, or directly by its testID.

Any test is automatically added to the groupID ALLGROUP

Parameters
testthe Launcher object used to run this test
testIDunique ID to refer to this test (will be used as std::map key)
groupsList of group-IDs selected by whitespace

Definition at line 131 of file suite.cpp.

References Registry::add2group(), and Suite::ALLGROUP.

Referenced by Launch< TEST >::Launch().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ groupID_

string groupID_
private

Definition at line 61 of file suite.hpp.

Referenced by Suite::describe(), and Suite::run().

◆ exitCode_

int exitCode_
private

Definition at line 62 of file suite.hpp.

Referenced by Suite::getExitCode(), and Suite::run().

◆ ALLGROUP

const string ALLGROUP = "ALL"
static

"magic" groupID containing all registered testcases

Definition at line 71 of file suite.hpp.

Referenced by TestOption::TestOption(), and Suite::enrol().

◆ TEST_OK

const int TEST_OK = 0
static

Definition at line 72 of file suite.hpp.

Referenced by test::anonymous_namespace{suite.cpp}::invokeTestCase().

◆ EXCEPTION_THROWN

const int EXCEPTION_THROWN = 5
static

exit code returned when any individual test threw

Definition at line 73 of file suite.hpp.

Referenced by test::anonymous_namespace{suite.cpp}::invokeTestCase().

+ Collaboration diagram for Suite:

The documentation for this class was generated from the following files: