14#include <source_location>
26namespace kaycxx::test::detail {
57 void add_suite(std::string_view description,
callback body, std::source_location location = std::source_location::current());
66 void add_test(std::string_view description,
callback body, std::source_location location = std::source_location::current());
178 std::vector<std::unique_ptr<detail::test_suite>> root_suites_;
181 std::vector<std::reference_wrapper<detail::test_suite>> suite_stack_;
188 detail::test_suite& current();
197 detail::test_suite& add_suite_node(std::string_view description, std::source_location location);
Defines the callback type used by the test framework.
Registered setup or teardown hook.
Definition hook.hpp:25
Receives lifecycle events from the test runner.
Definition reporter.hpp:22
Condition used by a test case to decide whether it should be skipped before running hooks and test co...
Definition skip.hpp:20
Owns a set of test suites and the registration stack used while suite bodies execute.
Definition test_registry.hpp:37
std::size_t num_test_suites(test_filter const &filter) const
Returns the number of suites containing tests selected by a filter.
void add_after_all_hook(hook value)
Adds an after_all hook to the current suite.
void add_before_each_hook(hook value)
Adds a before_each hook to the current suite.
std::size_t num_test_cases() const
Returns the number of all registered test cases.
void add_before_all_hook(hook value)
Adds a before_all hook to the current suite.
bool run(reporter &reporter, test_filter const &filter, run_options const &options={})
Executes registered tests selected by a filter.
std::size_t num_test_suites() const
Returns the number of all registered top-level and nested suites.
bool run(reporter &reporter, run_options const &options={})
Executes all registered top-level suites in declaration order.
std::vector< std::string > list_tests() const
Lists all registered test cases in execution order.
~test_registry()
Destroys the test registry and all registered suites.
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_cases(test_filter const &filter) const
Returns the number of test cases selected by a filter.
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_after_each_hook(hook value)
Adds an after_each hook to the current suite.
test_registry()
Creates an empty test registry.
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.
Defines registered test hooks.
Unit test framework functions and types.
Definition test.hpp:15
void reset_active_registry()
Resets the active registry to the default registry.
std::move_only_function< void()> callback
Callable block used by tests, suites, and hooks.
Definition callback.hpp:20
test_registry & set_active_registry(test_registry ®istry)
Changes the registry used by the public DSL functions.
test_registry & default_registry()
Returns the global registry used by the public DSL functions.
test_registry & active_registry()
Returns the registry currently used by the public DSL functions.
Defines the reporter interface used by the test runner.
Defines test execution options.
Defines skip conditions for test cases.
Configures the execution of registered tests.
Definition run_options.hpp:14
Selects registered tests by source path and full description.
Definition test_filter.hpp:23
Defines test selection filters.