#include <TestComponent.hh>
Inheritance diagram for ccunit::TestComponent:

Public Methods | |
| TestComponent (const string &name="(no name)") | |
| Simple ctor (accepts a name for the test component). More... | |
| virtual | ~TestComponent () |
| Destructor (does nothing). More... | |
| virtual void | Add (TestComponentPtr) |
| add a component to a composite; simply return for a leaf. More... | |
| virtual void | Remove (TestComponentPtr) |
| remove a component from a composite; simply return for a leaf. More... | |
| virtual bool | CheckRecursion (TestComponent *) const |
| return true for attempts to add self to composite; return false for a leaf. More... | |
| virtual void | run () |
| bool | hasRun () |
| Have the tests been executed yet? (No results are available until the tests have been executed). More... | |
| unsigned long | getNumPassed () |
| Return number of successful tests (only valid after run). More... | |
| unsigned long | getNumFailed () |
| Return number of unsuccessful tests (only valid after run). More... | |
| virtual void | report (ostream &ostr)=0 |
| Print a report on an output stream. More... | |
| virtual void | reset () |
| Reset the pass/fail counters and the run flag. More... | |
| void | setName (const string &name) |
| Set the name of this component. More... | |
| const string & | getName () const |
| Get the name of this component. More... | |
| void | checkRun () |
| If the m_hasRun is false, run the tests (should set m_hasRun). More... | |
| const list< ErrorReport > & | getFailures () const |
| get a reference to failure list. More... | |
Protected Methods | |
| virtual void | run_tests ()=0 |
| override this to actually run tests; call TestComponent::run() to execute tests. More... | |
Protected Attributes | |
| unsigned long | m_nPass |
| number of tests which have succeeded. More... | |
| unsigned long | m_nFail |
| number of tests which have failed. More... | |
| bool | m_hasRun |
| flag indicated whether the tests have been run (i.e., tabulated test data is ready). More... | |
| string | m_name |
| Test component name. More... | |
| list< ErrorReport > | m_failures |
| collect the failures for later reporting. More... | |
Friends | |
| ostream & | operator<< (ostream &ostr, TestComponentPtr my_test_component) |
| Print the test results (calls report if not done already). More... | |
| ostream & | operator<< (ostream &ostr, TestComponent &my_test_component) |
| Print the test results (calls report if not done already). More... | |
#
The Test Component is the basic building block for writing Unit Tests and Suites. This class implements much of the shared functionality. From this class there are two derived classes; UnitTest, and TestSuite.
Definition at line 33 of file TestComponent.hh.
|
|
Simple ctor (accepts a name for the test component).
Definition at line 18 of file TestComponent.cc. Referenced by CheckRecursion. |
|
|
Destructor (does nothing).
Definition at line 27 of file TestComponent.cc. |
|
|
add a component to a composite; simply return for a leaf.
Reimplemented in ccunit::AutoTestSuite. Definition at line 89 of file TestComponent.hh. References ccunit::TestComponentPtr. |
|
|
return true for attempts to add self to composite; return false for a leaf.
Reimplemented in ccunit::TestSuite. Definition at line 95 of file TestComponent.hh. References TestComponent. |
|
|
If the m_hasRun is false, run the tests (should set m_hasRun).
Definition at line 61 of file TestComponent.cc. Referenced by getNumFailed, getNumPassed, ccunit::UnitTest::report, and ccunit::TestSuite::report. |
|
|
get a reference to failure list.
Definition at line 140 of file TestComponent.hh. References m_failures. |
|
|
Get the name of this component.
Definition at line 134 of file TestComponent.hh. References m_name. Referenced by main. |
|
|
Return number of unsuccessful tests (only valid after run).
Definition at line 79 of file TestComponent.cc. References checkRun, and m_nFail. Referenced by main. |
|
|
Return number of successful tests (only valid after run).
Definition at line 72 of file TestComponent.cc. References checkRun, and m_nPass. Referenced by main. |
|
|
Have the tests been executed yet? (No results are available until the tests have been executed).
Definition at line 55 of file TestComponent.cc. References m_hasRun. |
|
|
remove a component from a composite; simply return for a leaf.
Reimplemented in ccunit::TestSuite. Definition at line 92 of file TestComponent.hh. References ccunit::TestComponentPtr. |
|
|
Print a report on an output stream.
Implemented in ccunit::TestSuite. |
|
|
Reset the pass/fail counters and the run flag.
Reimplemented in ccunit::TestSuite. Definition at line 86 of file TestComponent.cc. References m_failures, m_hasRun, m_nFail, and m_nPass. Referenced by run. |
|
|
Execute the tests, reporting failures on ostr. Sets the m_hasRun flag.
Definition at line 46 of file TestComponent.cc. |
|
|
override this to actually run tests; call TestComponent::run() to execute tests.
Implemented in StackTest. Referenced by run. |
|
|
Set the name of this component.
Definition at line 131 of file TestComponent.hh. References m_name. |
|
||||||||||||
|
Print the test results (calls report if not done already).
Definition at line 104 of file TestComponent.cc. |
|
||||||||||||
|
Print the test results (calls report if not done already).
Definition at line 96 of file TestComponent.cc. |
|
|
collect the failures for later reporting.
Definition at line 162 of file TestComponent.hh. Referenced by ccunit::UnitTest::do_fail, getFailures, ccunit::UnitTest::report, and reset. |
|
|
flag indicated whether the tests have been run (i.e., tabulated test data is ready).
Definition at line 156 of file TestComponent.hh. Referenced by checkRun, hasRun, ccunit::UnitTest::report, reset, run, and ccunit::TestSuite::run_tests. |
|
|
Test component name.
Definition at line 159 of file TestComponent.hh. |
|
|
number of tests which have failed.
Definition at line 153 of file TestComponent.hh. Referenced by ccunit::UnitTest::do_fail, getNumFailed, ccunit::UnitTest::report, reset, and ccunit::TestSuite::run_tests. |
|
|
number of tests which have succeeded.
Definition at line 150 of file TestComponent.hh. Referenced by ccunit::UnitTest::_succeed, getNumPassed, ccunit::UnitTest::report, reset, and ccunit::TestSuite::run_tests. |
1.2.14 written by Dimitri van Heesch,
© 1997-2002