|
template<class Lhs_T, class Rhs_T>
requires extension::any_op<std::remove_cvref_t<Lhs_T>, std::remove_cvref_t<Rhs_T>> |
| constexpr auto | micro_os_plus::micro_test_plus::operators::operator and (Lhs_T &&lhs, Rhs_T &&rhs) |
| | Deprecated logical && (and) operator.
|
template<class T>
requires extension::is_op<std::remove_cvref_t<T>> |
| constexpr auto | micro_os_plus::micro_test_plus::operators::operator not (T &&t) |
| | Deprecated logical ! (not) operator.
|
template<class Lhs_T, class Rhs_T>
requires extension::any_op<std::remove_cvref_t<Lhs_T>, std::remove_cvref_t<Rhs_T>> |
| constexpr auto | micro_os_plus::micro_test_plus::operators::operator or (Lhs_T &&lhs, Rhs_T &&rhs) |
| | Deprecated logical || (or) operator.
|
template<class Lhs_T, class Rhs_T>
requires extension::any_op<std::remove_cvref_t<Lhs_T>, std::remove_cvref_t<Rhs_T>> |
| constexpr auto | micro_os_plus::micro_test_plus::operators::operator!= (Lhs_T &&lhs, Rhs_T &&rhs) |
| | Deprecated non-equality operator.
|
template<class Lhs_T, class Rhs_T>
requires extension::any_op<std::remove_cvref_t<Lhs_T>, std::remove_cvref_t<Rhs_T>> |
| constexpr auto | micro_os_plus::micro_test_plus::operators::operator< (Lhs_T &&lhs, Rhs_T &&rhs) |
| | Deprecated less than operator.
|
template<class Lhs_T, class Rhs_T>
requires extension::any_op<std::remove_cvref_t<Lhs_T>, std::remove_cvref_t<Rhs_T>> |
| constexpr auto | micro_os_plus::micro_test_plus::operators::operator<= (Lhs_T &&lhs, Rhs_T &&rhs) |
| | Deprecated less than or equal operator.
|
template<class Lhs_T, class Rhs_T>
requires extension::any_op<std::remove_cvref_t<Lhs_T>, std::remove_cvref_t<Rhs_T>> |
| constexpr auto | micro_os_plus::micro_test_plus::operators::operator== (Lhs_T &&lhs, Rhs_T &&rhs) |
| | Deprecated equality operator.
|
template<class Lhs_T, class Rhs_T>
requires extension::any_op<std::remove_cvref_t<Lhs_T>, std::remove_cvref_t<Rhs_T>> |
| constexpr auto | micro_os_plus::micro_test_plus::operators::operator> (Lhs_T &&lhs, Rhs_T &&rhs) |
| | Deprecated greater than operator.
|
template<class Lhs_T, class Rhs_T>
requires extension::any_op<std::remove_cvref_t<Lhs_T>, std::remove_cvref_t<Rhs_T>> |
| constexpr auto | micro_os_plus::micro_test_plus::operators::operator>= (Lhs_T &&lhs, Rhs_T &&rhs) |
| | Deprecated greater than or equal operator.
|
The mt::operators namespace defines the comparison operators ==, !=, <, >, <=, and >=, and the logical operators and, or, and not, for the framework expression types. After using namespace mt::operators, a check such as t.expect (mt::to_i{ compute_answer () } == 42_i) reports the values of its operands, as the function comparators do.
- Deprecated
- The operators are deprecated since 6.0.0, in favour of the function comparators mt::eq(), mt::ne(), mt::lt(), mt::le(), mt::gt(), and mt::ge(), and of the logical functions mt::all_of(), mt::any_of(), and mt::negate(), which check and report the plain values, without literal suffixes or wrappers.
- Limitations
- The operators apply only when at least one operand is a framework expression type (see extension::is_op): a deprecated literal, such as 1_i, or a deprecated wrapper, such as mt::to_i{ value }. When neither operand is, the standard operator is selected; it returns a plain bool, so a failed check cannot show the operands.
- The overloaded and and or operators evaluate both operands before the check, so they do not short-circuit like the built-in ones.
- Replacement
ts.test ("Comparators", [] (auto& t) {
t.expect (mt::eq (compute_answer (), 42)) << "answer is 42";
t.expect (mt::ne (compute_answer (), 43)) << "answer is not 43";
t.expect (mt::lt (compute_answer (), 43)) << "answer is < 43";
t.expect (mt::le (compute_answer (), 43)) << "answer is <= 43";
t.expect (mt::gt (compute_answer (), 41)) << "answer is > 41";
t.expect (mt::ge (compute_answer (), 42)) << "answer is >= 42";
t.expect (mt::all_of (mt::eq (compute_answer (), 42),
mt::eq (compute_float (), 42.0f)));
});
Primary namespace for the µTest++ testing framework.