|
micro-test-plus 4.1.0
µTest++ Testing Framework
|
Expectations are checks whose outcomes are counted and reported. More...
Functions | |
| template<class Expr_T> requires type_traits::checkable<Expr_T> | |
| auto | micro_os_plus::micro_test_plus::subtest::expect (const Expr_T &expr, const reflection::source_location &sl=reflection::source_location::current()) |
| Evaluate a generic condition and report the results. | |
During test execution, each condition outcome, whether passing or failing, is explicitly reported in test results. Unlike assumptions, a failed expectation does not terminate the test; execution continues, allowing multiple conditions to be checked within a single test case.
This approach enables comprehensive validation of code behaviour, because all relevant expectations can be evaluated and reported in one run. Using expectations provides detailed insight into which aspects of the code meet requirements and which do not, supporting thorough and efficient testing.
| auto micro_os_plus::micro_test_plus::subtest::expect | ( | const Expr_T & | expr, |
| const reflection::source_location & | sl = reflection::source_location::current () ) |
| Expr_T | The type of the custom expression. |
| [in] | expr | Logical expression to evaluate. |
| [in] | sl | Optional source location, defaulting to the current line. |
Constructs and returns a deferred_reporter<Expr_T> with abort = false. The reporter evaluates the condition and records a pass or fail when it is destroyed at the end of the expression statement.
Definition at line 330 of file test-inlines.h.
References micro_os_plus::micro_test_plus::reporter::expression(), and micro_os_plus::micro_test_plus::detail::runnable< subtest >::reporter().
Referenced by operator=().