micro-test-plus 3.2.0
µTest++, a lightweight testing framework for embedded platforms
|
Expectations are checks whose results are reported. More...
Functions | |
template<class Expr_T , type_traits::requires_t< type_traits::is_op_v< Expr_T > or type_traits::is_convertible_v< Expr_T, bool > > = 0> | |
constexpr auto | micro_os_plus::micro_test_plus::expect (const Expr_T &expr, const reflection::source_location &sl=reflection::source_location::current()) |
Evaluate a generic condition and report the results. | |
Expectations are checks whose results are reported.
Failed expectations report the failure but do not break the test (as opposed to assumptions).
|
constexpr |
Evaluate a generic condition and report the results.
Expr_T | The type of the custom expression. |
[in] | expr | Logical expression to evaluate. |
[in] | sl | Optional source location, by default the current line. |
The expression can be any logical expression, but, in order to allow the framework to help identify the reason why the check failed (by displaying the actual vs. the expected values), the expression should use the provided eq()
, ne()
, lt()
, le()
, gt()
, ge()
comparators, or, if the custom operators namespace is included, to use the custom type operands.
The function template can be used only for expressions that evaluate to a boolean or use custom comparators/operators derived from the local detail::op
type.
For generic checks performed with standard C/C++ if
statements outside the expect()
logical expression (like complex try
/catch
statements), the results can be reported with expect(true)
or expect(false)
.
Definition at line 140 of file micro-test-plus.h.