The container for all unit tests. More...
#include <test_suite.hpp>
Classes | |
| struct | summary |
| Holds the summary result of the executed tests. More... | |
| struct | test_suite_args |
| struct | test_unit_args |
Public Types | |
| enum | test_suite_cmd { UNKNOWN = 0 , LIST , EXECUTE } |
| test_suite commands More... | |
| typedef std::vector< std::string > | t_string_vector |
Public Member Functions | |
| void | init (int argc, char *argv[]) |
| Initialize test_suite. | |
| void | register_unit (unit_test *utest) |
| Register a new test_unit serializable. | |
| bool | run () |
| Executes the test_suite. | |
| bool | run (const std::string &unit) |
| Executes a specific test_unit. | |
| bool | run (const test_unit_args &unit_args) |
| Executes a specific test_unit. | |
| bool | run (const std::string &unit, const std::string &test) |
| Executes a single test of a test_unit. | |
| std::size_t | size () const |
| bool | empty () const |
| t_unit_test_map::const_iterator | begin () const |
| t_unit_test_map::const_iterator | end () const |
| const summary & | test_summary () const |
| const test_suite_args & | test_args () const |
| void | quiet (bool q=true) |
The container for all unit tests.
The test_suite class is the container for all test_unit classes. It is a singleton, so only one instance exists. It can execute all test_units or a specific test_unit. It also provides function listing all test_unit classes and their tests.
| typedef std::vector<std::string> matador::test_suite::t_string_vector |
Shortcut for a string vector
test_suite commands
This is an enumeration for all test_suite commands
| Enumerator | |
|---|---|
| UNKNOWN | Enum type for an unknown test_suite command. |
| LIST | Enum type for the list command. |
| EXECUTE | Enum type for the execute command. |
| t_unit_test_map::const_iterator matador::test_suite::begin | ( | ) | const |
Returns the begin iterator of the unit test map
| bool matador::test_suite::empty | ( | ) | const |
Returns true if test suite is empty
| t_unit_test_map::const_iterator matador::test_suite::end | ( | ) | const |
Returns the end iterator of the unit test map
| void matador::test_suite::init | ( | int | argc, |
| char * | argv[] | ||
| ) |
Initialize test_suite.
Reads, parses and initializes the test_suite.
| argc | Number of arguments. |
| argv | List of arguments. |
| void matador::test_suite::quiet | ( | bool | q = true | ) |
Disables any output
| q | If true a output is disabled |
| void matador::test_suite::register_unit | ( | unit_test * | utest | ) |
Register a new test_unit serializable.
Registers a new test_unit serializable identified by the given name.
| utest | test_unit serializable. |
| bool matador::test_suite::run | ( | ) |
Executes the test_suite.
Executes all test unit classes or the command given via init.
| bool matador::test_suite::run | ( | const std::string & | unit | ) |
Executes a specific test_unit.
Executes the test_unit with the given name. If there is no test_unit serializable with such a name a message is displayed.
| unit | The name of the test_unit serializable to execute. |
| bool matador::test_suite::run | ( | const std::string & | unit, |
| const std::string & | test | ||
| ) |
Executes a single test of a test_unit.
Executes a single test of a test_unit serializable, identified by the name of the test and the name of the test_unit serializable. If test couldn't be found a message is displayed.
| unit | Name of the test_unit serializable. |
| test | Name of the test to execute. |
| bool matador::test_suite::run | ( | const test_unit_args & | unit_args | ) |
Executes a specific test_unit.
Executes the test_unit with the given args. Arguments contain name of test unit and a list of all tests to be executed. If list is empty all tests are executed. If there is no test_unit serializable with such a name a message is displayed.
| unit_args | The arguments of the test_unit to execute. |
| std::size_t matador::test_suite::size | ( | ) | const |
Returns the number of unit test classes
| const test_suite_args & matador::test_suite::test_args | ( | ) | const |
Returns test suites configurated arguments
| const summary & matador::test_suite::test_summary | ( | ) | const |
Return the current summary for the test suite