Owns a set of test suites and the registration stack used while suite bodies execute.
More...
#include <kaycxx/test/test_registry.hpp>
|
|
| test_registry () |
| | Creates an empty test registry.
|
| |
|
| ~test_registry () |
| | Destroys the test registry and all registered suites.
|
| |
|
| test_registry (test_registry const &)=delete |
| |
|
test_registry & | operator= (test_registry const &)=delete |
| |
| void | add_suite (std::string_view description, callback body, std::source_location location=std::source_location::current()) |
| | Adds a suite and immediately executes its registration body.
|
| |
| void | add_test (std::string_view description, callback body, std::source_location location=std::source_location::current()) |
| | Adds a test case to the current suite.
|
| |
| void | add_test (std::string_view description, skip_condition condition, callback body, std::source_location location=std::source_location::current()) |
| | Adds a test case with a skip condition to the current suite.
|
| |
| void | add_before_all_hook (hook value) |
| | Adds a before_all hook to the current suite.
|
| |
| void | add_before_each_hook (hook value) |
| | Adds a before_each hook to the current suite.
|
| |
| void | add_after_each_hook (hook value) |
| | Adds an after_each hook to the current suite.
|
| |
| void | add_after_all_hook (hook value) |
| | Adds an after_all hook to the current suite.
|
| |
| bool | run (reporter &reporter, run_options const &options={}) |
| | Executes all registered top-level suites in declaration order.
|
| |
| bool | run (reporter &reporter, test_filter const &filter, run_options const &options={}) |
| | Executes registered tests selected by a filter.
|
| |
| std::vector< std::string > | list_tests () const |
| | Lists all registered test cases in execution order.
|
| |
| std::vector< std::string > | list_tests (test_filter const &filter) const |
| | Lists registered test cases selected by a filter in execution order.
|
| |
| std::size_t | num_test_suites () const |
| | Returns the number of all registered top-level and nested suites.
|
| |
| std::size_t | num_test_suites (test_filter const &filter) const |
| | Returns the number of suites containing tests selected by a filter.
|
| |
| std::size_t | num_test_cases () const |
| | Returns the number of all registered test cases.
|
| |
| std::size_t | num_test_cases (test_filter const &filter) const |
| | Returns the number of test cases selected by a filter.
|
| |
Owns a set of test suites and the registration stack used while suite bodies execute.
◆ add_after_all_hook()
| void kaycxx::test::test_registry::add_after_all_hook |
( |
hook |
value | ) |
|
Adds an after_all hook to the current suite.
- Parameters
-
◆ add_after_each_hook()
| void kaycxx::test::test_registry::add_after_each_hook |
( |
hook |
value | ) |
|
Adds an after_each hook to the current suite.
- Parameters
-
◆ add_before_all_hook()
| void kaycxx::test::test_registry::add_before_all_hook |
( |
hook |
value | ) |
|
Adds a before_all hook to the current suite.
- Parameters
-
◆ add_before_each_hook()
| void kaycxx::test::test_registry::add_before_each_hook |
( |
hook |
value | ) |
|
Adds a before_each hook to the current suite.
- Parameters
-
◆ add_suite()
| void kaycxx::test::test_registry::add_suite |
( |
std::string_view |
description, |
|
|
callback |
body, |
|
|
std::source_location |
location = std::source_location::current() |
|
) |
| |
Adds a suite and immediately executes its registration body.
If no suite is currently active, this adds a top-level suite. Otherwise it adds a nested suite to the current suite.
- Parameters
-
| description | Human-readable suite description. |
| body | Registration callback that defines child suites, tests, and hooks. |
| location | Source location of the suite declaration. |
◆ add_test() [1/2]
| void kaycxx::test::test_registry::add_test |
( |
std::string_view |
description, |
|
|
callback |
body, |
|
|
std::source_location |
location = std::source_location::current() |
|
) |
| |
Adds a test case to the current suite.
- Parameters
-
| description | Human-readable test description. |
| body | Test callback to execute. |
| location | Source location of the test registration. |
◆ add_test() [2/2]
| void kaycxx::test::test_registry::add_test |
( |
std::string_view |
description, |
|
|
skip_condition |
condition, |
|
|
callback |
body, |
|
|
std::source_location |
location = std::source_location::current() |
|
) |
| |
Adds a test case with a skip condition to the current suite.
- Parameters
-
| description | Human-readable test description. |
| condition | Condition deciding if the test should be skipped. |
| body | Test callback to execute. |
| location | Source location of the test registration. |
◆ list_tests() [1/2]
| std::vector< std::string > kaycxx::test::test_registry::list_tests |
( |
| ) |
const |
Lists all registered test cases in execution order.
Duplicate full descriptions are returned only once.
- Returns
- Unique full descriptions of registered test cases.
◆ list_tests() [2/2]
| std::vector< std::string > kaycxx::test::test_registry::list_tests |
( |
test_filter const & |
filter | ) |
const |
Lists registered test cases selected by a filter in execution order.
- Parameters
-
| filter | Test selection filter. Duplicate full descriptions are returned only once. |
- Returns
- Unique full descriptions of selected test cases.
◆ num_test_cases() [1/2]
| std::size_t kaycxx::test::test_registry::num_test_cases |
( |
| ) |
const |
Returns the number of all registered test cases.
- Returns
- The number of all registered test cases.
◆ num_test_cases() [2/2]
| std::size_t kaycxx::test::test_registry::num_test_cases |
( |
test_filter const & |
filter | ) |
const |
Returns the number of test cases selected by a filter.
- Parameters
-
| filter | Test selection filter. |
- Returns
- The number of selected test cases.
◆ num_test_suites() [1/2]
| std::size_t kaycxx::test::test_registry::num_test_suites |
( |
| ) |
const |
Returns the number of all registered top-level and nested suites.
- Returns
- The number of all registered top-level and nested suites.
◆ num_test_suites() [2/2]
| std::size_t kaycxx::test::test_registry::num_test_suites |
( |
test_filter const & |
filter | ) |
const |
Returns the number of suites containing tests selected by a filter.
- Parameters
-
| filter | Test selection filter. |
- Returns
- The number of selected top-level and nested suites.
◆ run() [1/2]
Executes all registered top-level suites in declaration order.
- Parameters
-
| reporter | Reporter receiving lifecycle events. |
| options | Test execution options. |
- Returns
- True if all suites passed, false if any suite failed.
◆ run() [2/2]
Executes registered tests selected by a filter.
Suites without selected tests are not executed or reported. Suite hooks execute once for each selected suite.
- Parameters
-
| reporter | Reporter receiving lifecycle events. |
| filter | Test selection filter. |
| options | Test execution options. |
- Returns
- True if all selected suites passed, false if any selected suite failed.
The documentation for this class was generated from the following file: