Peano
Loading...
Searching...
No Matches
tarch::tests::TreeTestCaseCollection Class Reference

#include <TreeTestCaseCollection.h>

Inheritance diagram for tarch::tests::TreeTestCaseCollection:
Collaboration diagram for tarch::tests::TreeTestCaseCollection:

Public Member Functions

 TreeTestCaseCollection (const std::string &testCaseCollectionName="", bool deleteTestCases=true, bool writeToLog=true)
 Creates a test case collection.
 
virtual ~TreeTestCaseCollection ()
 Destructor.
 
virtual void run ()
 Runs all test cases assigned.
 
virtual void run (const std::string &prefix)
 Runs all test cases assigned.
 
void addTestCase (const std::string &fullQualifiedPath, TestCase *testCase)
 Adds a new test case.
 
void addTestCase (TestCase *testCase)
 Same as above, but fully qualified test case name is extracted from passed object.
 
- Public Member Functions inherited from tarch::tests::TestCase
 TestCase (const std::string &testCaseName)
 Constructor.
 
virtual ~TestCase ()
 Destructor.
 
int getNumberOfErrors () const
 
std::string getTestCaseName () const
 

Static Private Member Functions

static bool isNameWithoutHierarchy (const std::string &testCaseName)
 
static std::string getFirstIdentifierInHierarchy (const std::string &testCaseName)
 
static std::string getRemainingPathWithoutIdentifier (const std::string &testCaseName)
 

Private Attributes

std::list< TestCase * > _testCases
 Sequence of test cases that are executes on a run() call.
 
std::map< std::string, TreeTestCaseCollection * > _subTests
 
bool _writeToLog
 Tells the collection wheather to log a progression bar.
 
bool _deleteTestCases
 Tells whether the testcases contained should be deleted uppon destruction of this object.
 

Static Private Attributes

static tarch::logging::Log _log
 Log interface the class writes to.
 

Additional Inherited Members

- Protected Member Functions inherited from tarch::tests::TestCase
 TestCase ()=delete
 
- Protected Attributes inherited from tarch::tests::TestCase
const std::string _testCaseName
 Name of the test case.
 
int _errors
 Error counter.
 
bool _error
 Indicate within macro if one specific validation failed.
 

Detailed Description

Author
Tobias Weinzierl
Wolfgang Eckhardt
Version
Revision
1.7

Definition at line 24 of file TreeTestCaseCollection.h.

Constructor & Destructor Documentation

◆ TreeTestCaseCollection()

tarch::tests::TreeTestCaseCollection::TreeTestCaseCollection ( const std::string & testCaseCollectionName = "",
bool deleteTestCases = true,
bool writeToLog = true )

Creates a test case collection.

Parameters
testCaseCollectionNameName of the test case collection. May not contain ::. If you pass in the empty string "", it is a mere container. It still runs all sub test cases, but it does not dump any progress info on this particular package: Usually you get
  a.b.c ... ok
  a.b ... ok
  a ... pass (no local tests)
If a is "", then no message is written.

Definition at line 11 of file TreeTestCaseCollection.cpp.

References assertion3, and isNameWithoutHierarchy().

Here is the call graph for this function:

◆ ~TreeTestCaseCollection()

tarch::tests::TreeTestCaseCollection::~TreeTestCaseCollection ( )
virtual

Destructor.

Definition at line 19 of file TreeTestCaseCollection.cpp.

Member Function Documentation

◆ addTestCase() [1/2]

void tarch::tests::TreeTestCaseCollection::addTestCase ( const std::string & fullQualifiedPath,
TestCase * testCase )

Adds a new test case.

Although you pass a pointer, you are still responsible for the instance management.

You have to specify in the constructor of a TestCaseCollection whether it should delete testcases contained on construction.

@Note: default is set to false (i.e. no destruction)

Definition at line 128 of file TreeTestCaseCollection.cpp.

Referenced by exahype2::getUnitTests(), peano4::getUnitTests(), tarch::getUnitTests(), toolbox::blockstructured::getUnitTests(), toolbox::particles::assignmentchecks::getUnitTests(), toolbox::particles::getUnitTests(), and main().

Here is the caller graph for this function:

◆ addTestCase() [2/2]

void tarch::tests::TreeTestCaseCollection::addTestCase ( TestCase * testCase)

Same as above, but fully qualified test case name is extracted from passed object.

Definition at line 123 of file TreeTestCaseCollection.cpp.

References tarch::tests::TestCase::getTestCaseName().

Here is the call graph for this function:

◆ getFirstIdentifierInHierarchy()

std::string tarch::tests::TreeTestCaseCollection::getFirstIdentifierInHierarchy ( const std::string & testCaseName)
staticprivate

Definition at line 38 of file TreeTestCaseCollection.cpp.

References assertion2.

◆ getRemainingPathWithoutIdentifier()

std::string tarch::tests::TreeTestCaseCollection::getRemainingPathWithoutIdentifier ( const std::string & testCaseName)
staticprivate

Definition at line 47 of file TreeTestCaseCollection.cpp.

References assertion.

◆ isNameWithoutHierarchy()

bool tarch::tests::TreeTestCaseCollection::isNameWithoutHierarchy ( const std::string & testCaseName)
staticprivate

Definition at line 33 of file TreeTestCaseCollection.cpp.

Referenced by TreeTestCaseCollection().

Here is the caller graph for this function:

◆ run() [1/2]

void tarch::tests::TreeTestCaseCollection::run ( )
virtual

Runs all test cases assigned.

Implements tarch::tests::TestCase.

Definition at line 56 of file TreeTestCaseCollection.cpp.

Referenced by main().

Here is the caller graph for this function:

◆ run() [2/2]

void tarch::tests::TreeTestCaseCollection::run ( const std::string & prefix)
virtual

Runs all test cases assigned.

Definition at line 61 of file TreeTestCaseCollection.cpp.

References tarch::tests::TestCase::getNumberOfErrors(), logInfo, and tarch::tests::TestCase::run().

Here is the call graph for this function:

Field Documentation

◆ _deleteTestCases

bool tarch::tests::TreeTestCaseCollection::_deleteTestCases
private

Tells whether the testcases contained should be deleted uppon destruction of this object.

Definition at line 46 of file TreeTestCaseCollection.h.

◆ _log

tarch::logging::Log tarch::tests::TreeTestCaseCollection::_log
staticprivate

Log interface the class writes to.

Definition at line 41 of file TreeTestCaseCollection.h.

◆ _subTests

std::map<std::string, TreeTestCaseCollection*> tarch::tests::TreeTestCaseCollection::_subTests
private

Definition at line 31 of file TreeTestCaseCollection.h.

◆ _testCases

std::list<TestCase*> tarch::tests::TreeTestCaseCollection::_testCases
private

Sequence of test cases that are executes on a run() call.

The class is not responsible for destroying them.

Definition at line 30 of file TreeTestCaseCollection.h.

◆ _writeToLog

bool tarch::tests::TreeTestCaseCollection::_writeToLog
private

Tells the collection wheather to log a progression bar.

Definition at line 36 of file TreeTestCaseCollection.h.


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