|
CppTest
Version 2.0.0
|
#include <cpptest-suite.h>
Public Member Functions | |
| Suite () | |
| virtual | ~Suite () |
| void | add (std::unique_ptr< Suite > suite) |
| bool | run (Output &output, bool cont_after_fail=true) |
Protected Types | |
| typedef void(Suite::* | Func) () |
Protected Member Functions | |
| bool | continue_after_failure () const |
| virtual void | setup () |
| virtual void | tear_down () |
| void | register_test (Func func, const std::string &name) |
| void | assertment (Source s) |
Friends | |
| struct | DoRun |
| struct | ExecTests |
| struct | SubSuiteTests |
| struct | SubSuiteTime |
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().
|
protected |
Pointer to a test function.
| Test::Suite::Suite | ( | ) |
Constructs an empty test suite.
Referenced by tear_down().
|
virtual |
Destroys this suite object.
| void Test::Suite::add | ( | std::unique_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().
|
inlineprotectedvirtual |
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.
Referenced by assertment().
|
inlineprotectedvirtual |
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.
References assertment(), register_test(), and Suite().
Referenced by assertment().
|
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. |
Referenced by tear_down().
|
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(), Test::Time::current(), setup(), Test::Output::suite_start(), tear_down(), Test::Output::test_end(), and Test::Output::test_start().
Referenced by tear_down().
1.8.13