TestRunner
#include <icy/test.h>
class TestRunnerDefined in src/base/include/icy/test.h:148
The TestRunner is a queue in charge of running one or many tests.
When run() the TestRunner loops through each test in the list calling the test's run() method.
Public Methods
| Return | Name | Description |
|---|---|---|
TestRunner | ||
~TestRunner virtual | ||
void | add | Adds a test to the runner and prints its name to stdout. |
Test * | get const | Return a pointer to the test matching the given name, or nullptr if no matching test exists. |
void | run | Runs all registered tests sequentially, printing results to stdout. |
void | clear | Destroy and clears all managed tests. |
Test * | current const | Return the currently active Test or nullptr. |
TestList | tests const | Return the list of tests. |
ErrorMap | errors const | Return a map of tests and errors. |
bool | passed const | Return true if all tests passed. |
TestRunner
TestRunner()Defined in src/base/include/icy/test.h:151
~TestRunner
virtual
virtual ~TestRunner()Defined in src/base/include/icy/test.h:152
add
void add(Test * test)Defined in src/base/include/icy/test.h:156
Adds a test to the runner and prints its name to stdout.
Parameters
| Parameter | Type | Description |
|---|---|---|
test | Test * | Non-null pointer to the test; the runner takes ownership. |
get
const
Test * get(std::string_view name) constDefined in src/base/include/icy/test.h:162
Return a pointer to the test matching the given name, or nullptr if no matching test exists.
Returns
Matching test pointer or nullptr.
Parameters
| Parameter | Type | Description |
|---|---|---|
name | std::string_view | Test name to search for. |
run
void run()Defined in src/base/include/icy/test.h:165
Runs all registered tests sequentially, printing results to stdout.
clear
void clear()Defined in src/base/include/icy/test.h:168
Destroy and clears all managed tests.
current
const
Test * current() constDefined in src/base/include/icy/test.h:171
Return the currently active Test or nullptr.
tests
const
TestList tests() constDefined in src/base/include/icy/test.h:174
Return the list of tests.
errors
const
ErrorMap errors() constDefined in src/base/include/icy/test.h:177
Return a map of tests and errors.
passed
const
bool passed() constDefined in src/base/include/icy/test.h:180
Return true if all tests passed.
Public Static Methods
| Return | Name | Description |
|---|---|---|
TestRunner & | getDefault static | Return the default TestRunner singleton, although TestRunner instances may also be initialized individually. |
getDefault
static
static TestRunner & getDefault()Defined in src/base/include/icy/test.h:184
Return the default TestRunner singleton, although TestRunner instances may also be initialized individually.
Protected Attributes
_mutex
std::mutex _mutexDefined in src/base/include/icy/test.h:187
_tests
TestList _testsType: TestList
Defined in src/base/include/icy/test.h:188
_current
Test * _currentType: Test *
