| CppTest home page | CppTest project page |
Unit testing suite. More...
#include <cpptest-suite.h>
Unit testing suite.
Base class for all suites. Derive from this class to create own test suites.
Test functions in derived classes are registered as tests using the TEST_ADD(func). Testing is started by run(). Note that suites may be embedded in other suites using add().
typedef void(Suite::* Test::Suite::Func)() [protected] |
Pointer to a test function.
| Test::Suite::Suite | ( | ) |
Constructs an empty test suite.
| Test::Suite::~Suite | ( | ) | [virtual] |
Destroys this suite object.
| void Test::Suite::add | ( | std::auto_ptr< Suite > | suite | ) |
Adds a suite to this suite. Tests in added suites will be executed when run() of the top-level suite is called.
| suite | Test suite to add. |
| bool Test::Suite::run | ( | Output & | output, |
| bool | cont_after_fail = true |
||
| ) |
Starts the testing. All tests in this suite and embedded suites will be executed.
| output | Progress report destination. |
| cont_after_fail | Continue functions despite failures. |
References Test::Output::finished(), and Test::Output::initialize().
| void Test::Suite::setup | ( | ) | [inline, protected, virtual] |
Setups a test fixture. This function is called before each test, in this suite, is executed.
This function should be overloaded by derived classes to provide specialized behavior.
| void Test::Suite::tear_down | ( | ) | [inline, protected, virtual] |
Tears down a test fixture. This function is called after each test, in this suite, have been executed.
This function should be overloaded by derived classes to provide specialized behavior.
| void Test::Suite::register_test | ( | Func | func, |
| const std::string & | name | ||
| ) | [protected] |
Registers a test function.
Note: Do not call this function directly, use the TEST_ADD(func) macro instead.
| func | Pointer to a test function. |
| name | Class and function name of the function. The format must equal class::func. |
| void Test::Suite::assertment | ( | Source | s | ) | [protected] |
Issues an assertment to the output handler.
Do not call this function directly, use one of the available assertment macros instead, see Available asserts.
| s | Assert point information. |
References Test::Output::assertment().