micro-test-plus 4.1.0
µTest++ Testing Framework
Loading...
Searching...
No Matches
Test Cases

Test cases are named sequences of checks. More...

Classes

class  micro_os_plus::micro_test_plus::subtest
 A named, runnable test case that lives inside a suite. More...

Detailed Description

Each test case is defined by calling suite::test() with a descriptive name and a callable object (typically a lambda accepting a subtest& reference), along with any optional arguments required for the test.

Test cases allow related checks to be organised together within the same environment, improving clarity and maintainability. Any number of test cases may be defined, each focusing on a specific aspect of the code under test.

By grouping checks in this way, developers can identify which functionality is being verified and interpret results in the context of overall software quality.

Examples
// In main(), after tr.initialise():
ts.test ("Check various conditions", [] (auto& t) {
t.expect (mt::eq (compute_answer (), 42)) << "answer eq 42";
t.expect (mt::ne (compute_answer (), 43)) << "answer ne 43";
});
ts.test ("Check various conditions with operators", [] (auto& t) {
using namespace mt::operators;
using namespace mt::literals;
t.expect (compute_answer () == 42_i) << "answer == 42";
t.expect (compute_answer () != 43_i) << "answer != 43";
});
Primary namespace for the µTest++ testing framework.