micro-test-plus 6.0.0
µTest++ Testing Framework
Loading...
Searching...
No Matches
Old logical function names

Deprecated v5.0.1 names of the logical functions. More...

Deprecated Functions

template<class Expr_T>
constexpr auto micro_os_plus::micro_test_plus::_not (Expr_T &&expr)
 Deprecated generic logical not operation, the v5.0.1 name of negate().
template<class Lhs_T, class Rhs_T>
constexpr auto micro_os_plus::micro_test_plus::_and (Lhs_T &&lhs, Rhs_T &&rhs)
 Deprecated generic logical and operation, the v5.0.1 name of all_of().
template<class Lhs_T, class Rhs_T>
constexpr auto micro_os_plus::micro_test_plus::_or (Lhs_T &&lhs, Rhs_T &&rhs)
 Deprecated generic logical (inclusive) or operation, the v5.0.1 name of any_of().
template<class T>
constexpr auto micro_os_plus::micro_test_plus::mut (const T &t) noexcept -> T &
 Deprecated generic mutator to remove const qualification from a reference.
template<class T>
requires std::is_floating_point_v<T>
constexpr auto micro_os_plus::micro_test_plus::approx (T value, std::type_identity_t< T > epsilon) noexcept -> detail::value< T >
 Deprecated wrapping of a floating-point value with an explicit comparison tolerance.

Detailed Description

The functions mt::_and(), mt::_or(), and mt::_not() are the v5.0.1 names of mt::all_of(), mt::any_of(), and mt::negate(), and behave as them. They are deprecated since 6.0.0, because no other current public name starts with an underscore.

Deprecated Replacement
mt::_and() mt::all_of()
mt::_or() mt::any_of()
mt::_not() mt::negate()

Unlike the replacements, mt::_and() and mt::_or() take exactly two operands, whereas mt::all_of() and mt::any_of() take two or more.

Example
// Deprecated.
t.expect (mt::_and (mt::eq (compute_answer (), 42),
mt::lt (compute_answer (), 43)));
// Replacement.
t.expect (mt::all_of (mt::eq (compute_answer (), 42),
mt::lt (compute_answer (), 43)));

The overloaded logical operators of the mt::operators namespace are also deprecated since 6.0.0, in favour of the same functions.

Function Documentation

◆ _and()

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

The same as all_of(). The name was changed since a leading underscore is not used by the other current public names.

Template Parameters
Lhs_TType of the left hand side operand.
Rhs_TType of the right hand side operand.
Parameters
lhsLeft hand side operand.
rhsRight hand side operand.
Returns
An object that evaluates to true if both operand expressions are true.
Deprecated
use all_of() (since 6.0.0)

Forwards to all_of(), so the returned expression is the same, and is reported in the same way.

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

699 {
700 return all_of (std::forward<Lhs_T> (lhs), std::forward<Rhs_T> (rhs));
701 }
constexpr auto all_of(First_T &&first, Second_T &&second, Rest_T &&... rest)
Generic logical and operation, for two or more operands.

References _and(), and all_of().

Referenced by _and().

◆ _not()

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

The same as negate(). The name was changed since a leading underscore is not used by the other current public names.

Template Parameters
Expr_TType of the operand.
Parameters
exprLogical expression to be negated.
Returns
An object that evaluates to true if the operand is false.
Deprecated
use negate() (since 6.0.0)

Forwards to negate(), so the returned expression is the same, and is reported in the same way.

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

686 {
687 return negate (std::forward<Expr_T> (expr));
688 }
constexpr auto negate(Expr_T &&expr)
Generic logical not operation.

References _not(), and negate().

Referenced by _not().

◆ _or()

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

The same as any_of(). The name was changed since a leading underscore is not used by the other current public names.

Template Parameters
Lhs_TType of the left hand side operand.
Rhs_TType of the right hand side operand.
Parameters
lhsLeft hand side operand.
rhsRight hand side operand.
Returns
An object that evaluates to true if at least one of the operand expressions is true, including when both are.
Deprecated
use any_of() (since 6.0.0)

Forwards to any_of(), so the returned expression is the same, and is reported in the same way.

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

712 {
713 return any_of (std::forward<Lhs_T> (lhs), std::forward<Rhs_T> (rhs));
714 }
constexpr auto any_of(First_T &&first, Second_T &&second, Rest_T &&... rest)
Generic logical (inclusive) or operation, for two or more operands.

References _or(), and any_of().

Referenced by _or().

◆ approx()

template<class T>
requires std::is_floating_point_v<T>
auto micro_os_plus::micro_test_plus::approx ( T value,
std::type_identity_t< T > epsilon ) -> detail::value< T >
nodiscardconstexprnoexcept

The floating-point literals (1.5_d) and wrappers (to_d{ 1.5 }) compare with a tolerance derived from the number of decimals written (0.1 for 1.5). approx() makes the tolerance explicit, independent of how the value is written. All six comparisons apply it: values whose difference is less than the tolerance are equal, and neither less nor greater. If both operands have a tolerance, the smaller one is used.

t.expect (mt::eq (compute_float (), mt::approx (42.0f, 0.001f)));

For a single comparison, also of integers, the approx (lhs, rhs, epsilon) function comparator may be used instead.

Template Parameters
TThe floating-point type of the value.
Parameters
valueThe expected value.
epsilonThe tolerance, converted to T.
Returns
A detail::value<T> wrapper, recognised by the comparators and the operators.
Deprecated
Use the function comparator approx (lhs, rhs, epsilon) instead (since 6.0.0).
Since
6.0.0
Deprecated
use approx (lhs, rhs, epsilon) (since 6.0.0)

Constructs the floating-point detail::value<T> with the given tolerance, instead of the one derived from the number of decimals of the value.

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

1279 {
1280 return detail::value<T>{ value, epsilon };
1281 }
Struct template representing a generic value, accessible via a getter.
Definition deprecated.h:629

References approx().

Referenced by approx(), and approx().

◆ mut()

template<class T>
auto micro_os_plus::micro_test_plus::mut ( const T & t) -> T &
nodiscardconstexprnoexcept

Not used by the framework. Equivalent to const_cast<T&> (t), which replaces it.

Warning
Modifying an object that was originally declared as const through the returned reference is undefined behaviour.
Template Parameters
TThe type of the input object.
Parameters
tThe object from which to remove const qualification.
Returns
A non-const reference to the input object.
Deprecated
use const_cast<T&> (since 6.0.0)

Removes the const qualifier from the reference with const_cast.

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

726 {
727 return const_cast<T&> (t);
728 }

References mut().

Referenced by mut().