TestRunner
TestRunner
#include <icy/test.h>class TestRunnerDefined in src/base/include/icy/test.h:148
Test manager queue.
The [TestRunner](#testrunner-1) is a queue in charge of running one or many tests.
When [run()](#run-10) the [TestRunner](#testrunner-1) loops through each test in the list calling the test's [run()](#run-10) method.
List of all members
| Name | Kind | Owner |
|---|---|---|
TestRunner | function | Declared here |
~TestRunner | function | Declared here |
add | function | Declared here |
get | function | Declared here |
run | function | Declared here |
clear | function | Declared here |
current | function | Declared here |
tests | function | Declared here |
errors | function | Declared here |
passed | function | Declared here |
getDefault | function | Declared here |
_mutex | variable | Declared here |
_tests | variable | Declared here |
_current | variable | Declared here |
Public Methods
| Return | Name | Description |
|---|---|---|
TestRunner | ||
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
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
testNon-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.
Parameters
nameTest name to search for.
Returns
Matching test pointer or nullptr.
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](#testrunner-1) singleton, although [TestRunner](#testrunner-1) instances may also be initialized individually. |
getDefault
static
static TestRunner & getDefault()Defined in src/base/include/icy/test.h:184
Return the default [TestRunner](#testrunner-1) singleton, although [TestRunner](#testrunner-1) instances may also be initialized individually.
Protected Attributes
_mutex
std::mutex _mutexDefined in src/base/include/icy/test.h:187
_tests
TestList _testsDefined in src/base/include/icy/test.h:188
_current
Test * _current