micro-test-plus 3.2.0
µTest++, a lightweight testing framework for embedded platforms
|
Test cases are named sequences of checks. More...
Functions | |
template<typename Callable_T , typename... Args_T> | |
void | micro_os_plus::micro_test_plus::test_case (const char *name, Callable_T &&callable, Args_T &&... arguments) |
Define and execute a test case. | |
Test cases are named sequences of checks.
Test cases group several checks to be executed in the same environment.
There can be any number of test cases, and each test case is performed by invoking a function, parametrised with a name/description, a callable (usually a lambda), and optional arguments.
void micro_os_plus::micro_test_plus::test_case | ( | const char * | name, |
Callable_T && | callable, | ||
Args_T &&... | arguments ) |
Define and execute a test case.
A test case is a sequence of test conditions (or simply tests, or checks), which are expectations/assumptions, i.e. conditions expected to be true.
Tests are based on logical expressions, which usually compute a result and compare it to an expected value. For C++ projects, it is also possible to check if, while evaluating an expression, exceptions are thrown or not. Each test either succeeds or fails. For expectations, the runner keeps counts of successful and failed tests.
A test case has a name, a function which performs the checks, and possibly arguments.
The test_case
implementation invokes the function with the provided arguments, and reports the results.
Callable_T | The type of an object that can be called. |
Args_T | The type of the callable arguments. |
[in] | name | The test case name or description. A short string used in the report. |
[in] | callable | A generic callable object, invoked to perform the test. Usually a lambda. |
[in] | arguments | A possibly empty list of arguments to be passed to the callable. |