Skip to main content

Operators

Deprecated overloaded operators for test comparisons. More...

Operators Index​

template <class Lhs_T, class Rhs_T>
constexpr autooperator and (Lhs_T &&lhs, Rhs_T &&rhs)

Deprecated logical && (and) operator. More...

template <class T>
constexpr autooperator not (T &&t)

Deprecated logical ! (not) operator. More...

template <class Lhs_T, class Rhs_T>
constexpr autooperator or (Lhs_T &&lhs, Rhs_T &&rhs)

Deprecated logical || (or) operator. More...

template <class Lhs_T, class Rhs_T>
constexpr autooperator!= (Lhs_T &&lhs, Rhs_T &&rhs)

Deprecated non-equality operator. More...

template <class Lhs_T, class Rhs_T>
constexpr autooperator< (Lhs_T &&lhs, Rhs_T &&rhs)

Deprecated less than operator. More...

template <class Lhs_T, class Rhs_T>
constexpr autooperator<= (Lhs_T &&lhs, Rhs_T &&rhs)

Deprecated less than or equal operator. More...

template <class Lhs_T, class Rhs_T>
constexpr autooperator== (Lhs_T &&lhs, Rhs_T &&rhs)

Deprecated equality operator. More...

template <class Lhs_T, class Rhs_T>
constexpr autooperator> (Lhs_T &&lhs, Rhs_T &&rhs)

Deprecated greater than operator. More...

template <class Lhs_T, class Rhs_T>
constexpr autooperator>= (Lhs_T &&lhs, Rhs_T &&rhs)

Deprecated greater than or equal operator. More...

Description​

Deprecated overloaded operators for test comparisons.

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)));
 });

Operators​

operator and()​

template <class Lhs_T, class Rhs_T>
auto micro_os_plus::micro_test_plus::operators::operator and (Lhs_T && lhs, Rhs_T && rhs)
nodiscard constexpr

Deprecated logical && (and) operator.

Template Parameters
Lhs_T

Type of the left hand side operand.

Rhs_T

Type of the right hand side operand.

Parameters
lhs

Left hand side operand.

rhs

Right hand side operand.

Returns

A logical conjunction object that evaluates to true if both operands are true.

Deprecated

use all_of() (since 6.0.0)

Constructs an and_op logical conjunction object from the two operands and returns it. The object evaluates to true if both operands are true. At least one operand must be a framework expression type (see extension::is_op).

Definition at line 854 of file deprecated-inlines.h.

854 operator and (Lhs_T&& lhs, Rhs_T&& rhs)
855 {
856 return detail::and_op{ std::forward<Lhs_T> (lhs),
857 std::forward<Rhs_T> (rhs) };
858 }

operator not()​

template <class T>
auto micro_os_plus::micro_test_plus::operators::operator not (T && t)
nodiscard constexpr

Deprecated logical ! (not) operator.

Template Parameters
T

Type of the operand, constrained to the framework expression types.

Parameters
t

Operand to be logically negated.

Returns

A logical negator object that evaluates to true if the operand is false.

Deprecated

use negate() (since 6.0.0)

Constructs a not_op logical negator object from the operand and returns it. The object evaluates to true if the operand is false. The operand must be a framework expression type (see extension::is_op).

Definition at line 886 of file deprecated-inlines.h.

886 operator not(T&& t)
887 {
888 // Not `not_op{ t }`, which would copy an operand that is itself
889 // a `not_op`, instead of negating it.
890 return detail::not_op<detail::stored_operand_t<T>>{ std::forward<T> (
891 t) };
892 }

operator or()​

template <class Lhs_T, class Rhs_T>
auto micro_os_plus::micro_test_plus::operators::operator or (Lhs_T && lhs, Rhs_T && rhs)
nodiscard constexpr

Deprecated logical || (or) operator.

Template Parameters
Lhs_T

Type of the left hand side operand.

Rhs_T

Type of the right hand side operand.

Parameters
lhs

Left hand side operand.

rhs

Right hand side operand.

Returns

A logical disjunction object that evaluates to true if at least one operand is true.

Deprecated

use any_of() (since 6.0.0)

Constructs an or_op logical disjunction object from the two operands and returns it. The object evaluates to true if at least one operand is true. At least one operand must be a framework expression type (see extension::is_op).

Definition at line 871 of file deprecated-inlines.h.

871 operator or (Lhs_T&& lhs, Rhs_T&& rhs)
872 {
873 return detail::or_op{ std::forward<Lhs_T> (lhs),
874 std::forward<Rhs_T> (rhs) };
875 }

operator!=()​

template <class Lhs_T, class Rhs_T>
auto micro_os_plus::micro_test_plus::operators::operator!= (Lhs_T && lhs, Rhs_T && rhs)
nodiscard constexpr

Deprecated non-equality operator.

Template Parameters
Lhs_T

Type of the left hand side operand.

Rhs_T

Type of the right hand side operand.

Parameters
lhs

Left hand side operand.

rhs

Right hand side operand.

Returns

A comparator object that evaluates to true if the operands are not equal.

Deprecated

use ne() (since 6.0.0)

Constructs a comparator object, with the not_equal_to tag, from the two operands and returns it. The comparator evaluates to true if the operands are not equal. At least one operand must be a framework expression type (see extension::is_op).

Definition at line 765 of file deprecated-inlines.h.

765 operator!=(Lhs_T&& lhs, Rhs_T&& rhs)
766 {
767 return detail::compare_op{ std::forward<Lhs_T> (lhs),
768 std::forward<Rhs_T> (rhs),
770 }

operator<()​

template <class Lhs_T, class Rhs_T>
auto micro_os_plus::micro_test_plus::operators::operator< (Lhs_T && lhs, Rhs_T && rhs)
nodiscard constexpr

Deprecated less than operator.

Template Parameters
Lhs_T

Type of the left hand side operand.

Rhs_T

Type of the right hand side operand.

Parameters
lhs

Left hand side operand.

rhs

Right hand side operand.

Returns

A comparator object that evaluates to true if the left hand side operand is less than the right hand side operand.

Deprecated

use lt() (since 6.0.0)

Constructs a comparator object, with the less tag, from the two operands and returns it. The comparator evaluates to true if lhs is less than rhs. At least one operand must be a framework expression type (see extension::is_op).

Definition at line 818 of file deprecated-inlines.h.

819 operator<(Lhs_T&& lhs, Rhs_T&& rhs)
820 {
821 return detail::compare_op{ std::forward<Lhs_T> (lhs),
822 std::forward<Rhs_T> (rhs), detail::less{} };
823 }

operator<=()​

template <class Lhs_T, class Rhs_T>
auto micro_os_plus::micro_test_plus::operators::operator<= (Lhs_T && lhs, Rhs_T && rhs)
nodiscard constexpr

Deprecated less than or equal operator.

Template Parameters
Lhs_T

Type of the left hand side operand.

Rhs_T

Type of the right hand side operand.

Parameters
lhs

Left hand side operand.

rhs

Right hand side operand.

Returns

A comparator object that evaluates to true if the left hand side operand is less than or equal to the right hand side operand.

Deprecated

use le() (since 6.0.0)

Constructs a comparator object, with the less_equal tag, from the two operands and returns it. The comparator evaluates to true if lhs is less than or equal to rhs. At least one operand must be a framework type (see extension::is_op).

Definition at line 835 of file deprecated-inlines.h.

836 operator<=(Lhs_T&& lhs, Rhs_T&& rhs)
837 {
838 return detail::compare_op{ std::forward<Lhs_T> (lhs),
839 std::forward<Rhs_T> (rhs),
841 }

operator==()​

template <class Lhs_T, class Rhs_T>
auto micro_os_plus::micro_test_plus::operators::operator== (Lhs_T && lhs, Rhs_T && rhs)
nodiscard constexpr

Deprecated equality operator.

Template Parameters
Lhs_T

Type of the left hand side operand.

Rhs_T

Type of the right hand side operand.

Parameters
lhs

Left hand side operand.

rhs

Right hand side operand.

Returns

A comparator object that evaluates to true if the operands are equal.

Deprecated

use eq() (since 6.0.0)

Constructs a comparator object, with the equal_to tag, from the two operands and returns it. The comparator evaluates to true if the operands are equal. At least one operand must be a framework expression type (see extension::is_op).

Definition at line 747 of file deprecated-inlines.h.

747 operator==(Lhs_T&& lhs, Rhs_T&& rhs)
748 {
749 return detail::compare_op{ std::forward<Lhs_T> (lhs),
750 std::forward<Rhs_T> (rhs),
752 }

operator>()​

template <class Lhs_T, class Rhs_T>
auto micro_os_plus::micro_test_plus::operators::operator> (Lhs_T && lhs, Rhs_T && rhs)
nodiscard constexpr

Deprecated greater than operator.

Template Parameters
Lhs_T

Type of the left hand side operand.

Rhs_T

Type of the right hand side operand.

Parameters
lhs

Left hand side operand.

rhs

Right hand side operand.

Returns

A comparator object that evaluates to true if the left hand side operand is greater than the right hand side operand.

Deprecated

use gt() (since 6.0.0)

Constructs a comparator object, with the greater tag, from the two operands and returns it. The comparator evaluates to true if lhs is greater than rhs. At least one operand must be a framework expression type (see extension::is_op).

Definition at line 783 of file deprecated-inlines.h.

783 operator>(Lhs_T&& lhs, Rhs_T&& rhs)
784 {
785 return detail::compare_op{ std::forward<Lhs_T> (lhs),
786 std::forward<Rhs_T> (rhs),
788 }

operator>=()​

template <class Lhs_T, class Rhs_T>
auto micro_os_plus::micro_test_plus::operators::operator>= (Lhs_T && lhs, Rhs_T && rhs)
nodiscard constexpr

Deprecated greater than or equal operator.

Template Parameters
Lhs_T

Type of the left hand side operand.

Rhs_T

Type of the right hand side operand.

Parameters
lhs

Left hand side operand.

rhs

Right hand side operand.

Returns

A comparator object that evaluates to true if the left hand side operand is greater than or equal to the right hand side operand.

Deprecated

use ge() (since 6.0.0)

Constructs a comparator object, with the greater_equal tag, from the two operands and returns it. The comparator evaluates to true if lhs is greater than or equal to rhs. At least one operand must be a framework expression type (see extension::is_op).

Definition at line 801 of file deprecated-inlines.h.

801 operator>=(Lhs_T&& lhs, Rhs_T&& rhs)
802 {
803 return detail::compare_op{ std::forward<Lhs_T> (lhs),
804 std::forward<Rhs_T> (rhs),
806 }

Generated via doxygen2docusaurus 2.2.8 by Doxygen 1.18.0.