#include <Pt/Unit/Application.h>

Public Member Functions | |
| Application () | |
| Default Constructor. | |
| virtual | ~Application () |
| Destructor. | |
| Test * | findTest (const std::string &testname) |
| Find a test by name. | |
| void | attachReporter (Reporter &r) |
| Add reporter for test events. | |
| void | attachReporter (Reporter &r, const std::string &testname) |
| Add reporter for test events. | |
| void | run (const std::string &testName) |
| Run test by name. | |
| virtual void | run () |
| Run all tests. | |
| unsigned | errors () const |
| Returns the number of errors which occured during a run. | |
| void | registerTest (Test &test) |
| Register a test. | |
| void | deregisterTest (Test &test) |
Static Public Member Functions | |
| static Application & | instance () |
| static std::list< Test * > & | tests () |
| Returns a list of all registered test TODO: find another way to query available tests. | |
int main() { Pt::Unit::Reporter reporter; Pt::Unit::Application app; app.setReporter(reporter); return app.run(); }
The TestMain.h include already defines a main loop with an application for the common use case.
| Test* findTest | ( | const std::string & | testname | ) |
Returns a pointer to the found test or 0 if not found.
| void attachReporter | ( | Reporter & | r | ) |
Adds the reporter r to report test events.
Reimplemented from Test.
| void attachReporter | ( | Reporter & | r, | |
| const std::string & | testname | |||
| ) |
Adds the reporter r to report test events of the test name testname.
| void run | ( | const std::string & | testName | ) |
This method will run a previously registered test. Use the RegisterTest<T> template to register a test to the application.
| testName | name of the test to be run |
| virtual void run | ( | ) | [virtual] |
This method will run all tests that have been registered previously. Use the RegisterTest<T> template to register a test to the application.
Implements Test.
| void registerTest | ( | Test & | test | ) |
Registers the test test to the application. The application will not own the test and the caller has to make sure it exists as long as the application object. Tests can be deregistered by calling deregisterTest.
| static std::list<Test*>& tests | ( | ) | [static] |