PSCF v1.1
|
A TestRunner comprised of one or more child TestRunners. More...
#include <CompositeTestRunner.h>
Public Member Functions | |
virtual | ~CompositeTestRunner () |
Destructor. More... | |
void | addChild (TestRunner &child) |
Add an existing TestRunner as a child. More... | |
void | addChild (TestRunner *childPtr) |
Add a TestRunner as a child, and accept ownership. More... | |
void | addChild (TestRunner *childPtr, const std::string &prefix) |
Add a TestRunner as a child, accept ownership, and initialize filePrefix. More... | |
virtual void | addFilePrefix (const std::string &prefix) |
Prepend argument prefix to existing filePrefix. More... | |
virtual int | run () |
Run all children in sequence, using depth-first recursion. More... | |
Public Member Functions inherited from TestRunner | |
TestRunner () | |
Constructor. More... | |
virtual | ~TestRunner () |
Destructor. More... | |
virtual int | run ()=0 |
Run all tests. More... | |
void | recordFailure () |
Increment counter for failed tests, and that of parent (if any). More... | |
void | recordSuccess () |
Increment counter for successful tests, and that of parent (if any). More... | |
void | setParent (TestRunner &parent) |
Set another TestRunner as the parent. More... | |
TestRunner & | parent () |
Return the parent object, if any. More... | |
bool | hasParent () const |
Does this object have a parent? More... | |
int | nSuccess () const |
Return number of successful tests run. More... | |
int | nFailure () const |
Return number of failed tests run. More... | |
void | report () const |
If this object has no parent, report success and failure counters. More... | |
bool | isIoProcessor () const |
Is this the IO processor of an MPI communicator? More... | |
virtual void | addFilePrefix (const std::string &prefix) |
Prepend argument prefix to existing filePrefix. More... | |
const std::string & | filePrefix () const |
Return file prefix by const reference. More... | |
Additional Inherited Members | |
Protected Attributes inherited from TestRunner | |
std::string | filePrefix_ |
Prefix added to file names. More... | |
A TestRunner comprised of one or more child TestRunners.
Definition at line 19 of file CompositeTestRunner.h.
|
virtual |
Destructor.
Definition at line 97 of file CompositeTestRunner.h.
void CompositeTestRunner::addChild | ( | TestRunner & | child | ) |
Add an existing TestRunner as a child.
Children added by this method are not destroyed by the parent CompositeTestRunner destructor.
child | enclosed TestRunner object |
Definition at line 108 of file CompositeTestRunner.h.
References TestRunner::setParent().
Referenced by addChild(), and pscfpp.param.Composite::read().
void CompositeTestRunner::addChild | ( | TestRunner * | childPtr | ) |
Add a TestRunner as a child, and accept ownership.
Children added by this method are owned by the parent CompositeTestRunner, and so are destroyed by its destructor.
childPtr | pointer to child TestRunner |
Definition at line 117 of file CompositeTestRunner.h.
References TestRunner::setParent().
Referenced by pscfpp.param.Composite::read().
void CompositeTestRunner::addChild | ( | TestRunner * | childPtr, |
const std::string & | prefix | ||
) |
Add a TestRunner as a child, accept ownership, and initialize filePrefix.
Children added by this method are owned by the parent CompositeTestRunner, and so are destroyed by its destructor. The file prefix argument should normally be a path for a particular child defined relative to any common prefix used by all tests in this composite. The common prefix can then be prepended by calling addFilePrefix at run time.
childPtr | pointer to child TestRunner |
prefix | prefix to append to file names in all descendants |
Definition at line 127 of file CompositeTestRunner.h.
References addChild(), and TestRunner::addFilePrefix().
Referenced by pscfpp.param.Composite::read().
|
virtual |
Prepend argument prefix to existing filePrefix.
This function also prepends prefix to all children. If this function is called at run-time for the highest level composite in a hierarchy, the prefix is thus propagated to all TestRunners in the hierarchy, and thus also used in the methods of UnitTest that are used to open files.
prefix | string to prepend to existing filePrefix. |
Reimplemented from TestRunner.
Definition at line 137 of file CompositeTestRunner.h.
References TestRunner::addFilePrefix().
|
virtual |
Run all children in sequence, using depth-first recursion.
Implements TestRunner.
Definition at line 148 of file CompositeTestRunner.h.
References TestRunner::nFailure(), and TestRunner::report().