micro-test-plus 3.2.0
µTest++, a lightweight testing framework for embedded platforms
Loading...
Searching...
No Matches
Assumptions

Assumptions are conditions that must be met for the test to continue. 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::assume (const Expr_T &expr, const reflection::source_location &sl=reflection::source_location::current())
 Check a condition and, if false, abort.
 

Detailed Description

Assumptions are conditions that must be met for the test to continue.

On failed assumptions, the test cannot continue and it is aborted on the spot.

Function Documentation

◆ assume()

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::assume ( const Expr_T & expr,
const reflection::source_location & sl = reflection::source_location::current () )
constexpr

Check a condition and, if false, abort.

Template Parameters
Expr_TThe type of the custom expression.
Parameters
[in]exprLogical expression to evaluate.
[in]slOptional source location, by default the current line.
Returns
An output stream to write optional messages.

The template is usable only for expressions that evaluate to a boolean or use custom comparators/operators derived from the local detail::op type.

Example
mt::assume (compute_answer () == 42) << "answer is 42";

Definition at line 170 of file micro-test-plus.h.