micro-test-plus 3.2.2
The µTest++ Testing Framework
Loading...
Searching...
No Matches

Functions to be used in logical expressions. More...

Functions

template<class Lhs_T, class Rhs_T>
constexpr auto micro_os_plus::micro_test_plus::_and (const Lhs_T &lhs, const Rhs_T &rhs)
 Generic logical and.
 
template<class Expr_T>
constexpr auto micro_os_plus::micro_test_plus::_not (const Expr_T &expr)
 Generic logical not.
 
template<class Lhs_T, class Rhs_T>
constexpr auto micro_os_plus::micro_test_plus::_or (const Lhs_T &lhs, const Rhs_T &rhs)
 Generic logical or.
 

Detailed Description

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.

Function Documentation

◆ _and()

template<class Lhs_T, class Rhs_T>
auto micro_os_plus::micro_test_plus::_and ( const Lhs_T & lhs,
const Rhs_T & rhs )
nodiscardconstexpr

Generic logical and.

Template Parameters
Lhs_TType of the left hand side operand.
Rhs_TType of the right hand side operand.
Parameters
[in]lhsLeft hand side operand.
[in]rhsRight 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 451 of file micro-test-plus.h.

◆ _not()

template<class Expr_T>
auto micro_os_plus::micro_test_plus::_not ( const Expr_T & expr)
nodiscardconstexpr

Generic logical not.

Template Parameters
Expr_TType of the operand.
Parameters
[in]exprLogical expression.
Returns
True if the operand is false.
Note
The underscore is intentional, to differentiate from the standard operator.

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

◆ _or()

template<class Lhs_T, class Rhs_T>
auto micro_os_plus::micro_test_plus::_or ( const Lhs_T & lhs,
const Rhs_T & rhs )
nodiscardconstexpr

Generic logical or.

Template Parameters
Lhs_TType of the left hand side operand.
Rhs_TType of the right hand side operand.
Parameters
[in]lhsLeft hand side operand.
[in]rhsRight 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 471 of file micro-test-plus.h.