Class Registry

Class Documentation

class Registry
[source]

Central repository of all registered tests.

Tests are registered automatically at static-initialization time by Installer instances created by the TEST() and TEST_GROUP() macros. CommandLineRunner retrieves the current registry via get_current_registry() and delegates to run_all_tests() to execute them.

Public Functions

Registry()
[source]

Construct an empty registry.

virtual ~Registry() = default
[source]
virtual void add_test(Shell *test)

Append test to the registered test list.

Parameters:

testShell to register.

virtual void un_do_last_add_test()
[source]

Remove the most recently added test (used by Installer::un_do()).

virtual size_t count_tests()
[source]
Returns:

Number of registered tests.

virtual void run_all_tests(Result &result)

Run all tests that pass the current filters.

Parameters:

result – Accumulator for results and output.

virtual void shuffle_tests(size_t seed)

Shuffle the test execution order using a seeded algorithm.

Parameters:

seed – Random seed.

virtual void reverse_tests()
[source]

Reverse the test execution order.

virtual void list_test_group_names(Result &result)

Print all registered group names to result.

Parameters:

resultOutput sink.

virtual void list_test_group_and_case_names(Result &result)

Print all group.case names to result.

Parameters:

resultOutput sink.

virtual void list_test_locations(Result &result)

Print all test source locations to result.

Parameters:

resultOutput sink.

virtual void list_ordered_test_locations(Result &result)

Print all ordered-test source locations to result.

Parameters:

resultOutput sink.

virtual void list_test_group_locations(Result &result)

Print all test-group source locations to result.

Each line has the format group.file.line. Locations are taken from mu::tiny::test::GroupLocation instances registered by the TEST_GROUP() macro, so they point to the group declaration itself rather than any individual test inside it.

Parameters:

resultOutput sink.

virtual void set_name_filters(const Filter *filters)

Set the name filters applied when running tests.

Parameters:

filters – Linked list of name filters; may be nullptr.

virtual void set_group_filters(const Filter *filters)

Set the group filters applied when running tests.

Parameters:

filters – Linked list of group filters; may be nullptr.

virtual void install_plugin(Plugin *plugin)

Append plugin to the plugin chain.

Parameters:

pluginPlugin to install.

virtual void reset_plugins()
[source]

Remove all plugins from the chain.

virtual void restore_plugins(Plugin *head)

Restore the plugin chain to a previously saved head.

Intended for use with get_first_plugin(): save the head before installing temporary plugins, then call this to undo those installations.

Parameters:

headPlugin to make the new head of the chain.

virtual Plugin *get_first_plugin()
[source]
Returns:

The first plugin in the chain, or nullptr.

virtual int count_plugins()
[source]
Returns:

Number of installed plugins.

virtual Shell *get_first_test()
[source]
Returns:

The first registered test, or nullptr.

virtual Shell *get_test_with_next(Shell *test)

Return the test after test in registration order.

Parameters:

test – Current test.

Returns:

The next test, or nullptr.

virtual Shell *find_test_with_name(const String &name)

Find the first test whose name matches name.

Parameters:

nameTest name to search for.

Returns:

The matching Shell, or nullptr.

virtual Shell *find_test_with_group(const String &name)

Find the first test in the group named name.

Parameters:

name – Group name to search for.

Returns:

The matching Shell, or nullptr.

virtual void set_current_registry(Registry *registry)

Replace the process-wide current registry.

Parameters:

registry – New current registry.

inline int get_current_repetition() const
Returns:

The current repetition number (1-based during a multi-run).

void set_run_skipped()
[source]

Enable running SKIPPED_TEST() tests in this registry.

Public Static Functions

static Registry *get_current_registry()
[source]
Returns:

The process-wide current registry (used by the TEST() macro and CommandLineRunner).