Functions to be used in logical expressions.
More...
Functions to be used in logical expressions.
Complex expressions can be checked in a single line, using the logical mt::_and()
, mt::_or()
and mt::_not()
functions.
- Note
- The names are prefixed with underscore since
and
, or
and not
are reserved words in C/C++.
- Example
mt::expect(mt::_and (mt::eq (compute_answer (), 42), mt::eq (compute_float (), 42.0)));
- Note
- If operands are function comparators, it is recommended to use the overloaded logical operators
&&
, ||
, !
available in the micro_test_plus::operators
namespace.
◆ _and()
template<class Lhs_T , class Rhs_T >
constexpr auto micro_os_plus::micro_test_plus::_and |
( |
const Lhs_T & | lhs, |
|
|
const Rhs_T & | rhs ) |
|
constexpr |
Generic logical and.
- Template Parameters
-
Lhs_T | Type of the left hand side operand. |
Rhs_T | Type of the right hand side operand. |
- Parameters
-
[in] | lhs | Left hand side operand. |
[in] | rhs | Right hand side operand. |
- Returns
- True if both operand expressions are true.
- Note
- The underscore is intentional, to differentiate from the standard operator.
Definition at line 452 of file micro-test-plus.h.
◆ _not()
template<class Expr_T >
constexpr auto micro_os_plus::micro_test_plus::_not |
( |
const Expr_T & | expr | ) |
|
|
constexpr |
Generic logical not.
- Template Parameters
-
Expr_T | Type of the operand. |
- Parameters
-
[in] | expr | Logical expression. |
- Returns
- True if the operand is false.
- Note
- The underscore is intentional, to differentiate from the standard operator.
Definition at line 432 of file micro-test-plus.h.
◆ _or()
template<class Lhs_T , class Rhs_T >
constexpr auto micro_os_plus::micro_test_plus::_or |
( |
const Lhs_T & | lhs, |
|
|
const Rhs_T & | rhs ) |
|
constexpr |
Generic logical or.
- Template Parameters
-
Lhs_T | Type of the left hand side operand. |
Rhs_T | Type of the right hand side operand. |
- Parameters
-
[in] | lhs | Left hand side operand. |
[in] | rhs | Right hand side operand. |
- Returns
- True if at least one of the operand expressions is true.
- Note
- The underscore is intentional, to differentiate from the standard operator.
Definition at line 472 of file micro-test-plus.h.