44#ifndef MICRO_OS_PLUS_MICRO_TEST_PLUS_INLINES_FUNCTION_COMPARATORS_INLINES_H_
45#define MICRO_OS_PLUS_MICRO_TEST_PLUS_INLINES_FUNCTION_COMPARATORS_INLINES_H_
49#if defined(__cplusplus)
54#pragma GCC diagnostic push
56#pragma GCC diagnostic ignored "-Waggregate-return"
58#pragma clang diagnostic ignored "-Wc++98-compat"
59#pragma clang diagnostic ignored "-Wc++98-compat-pedantic"
85 template <
class Lhs_T,
class Rhs_T>
89 eq (Lhs_T&& lhs, Rhs_T&& rhs)
96#if !defined(__DOXYGEN__)
102 template <
class Lhs_T,
class Rhs_T>
106 eq ([[maybe_unused]] Lhs_T&& lhs, [[maybe_unused]] Rhs_T&& rhs)
121 template <
class Lhs_T,
class Rhs_T>
125 ne (Lhs_T&& lhs, Rhs_T&& rhs)
132#if !defined(__DOXYGEN__)
138 template <
class Lhs_T,
class Rhs_T>
142 ne ([[maybe_unused]] Lhs_T&& lhs, [[maybe_unused]] Rhs_T&& rhs)
157 template <
class Lhs_T,
class Rhs_T>
161 gt (Lhs_T&& lhs, Rhs_T&& rhs)
168#if !defined(__DOXYGEN__)
174 template <
class Lhs_T,
class Rhs_T>
178 gt ([[maybe_unused]] Lhs_T&& lhs, [[maybe_unused]] Rhs_T&& rhs)
193 template <
class Lhs_T,
class Rhs_T>
197 ge (Lhs_T&& lhs, Rhs_T&& rhs)
204#if !defined(__DOXYGEN__)
210 template <
class Lhs_T,
class Rhs_T>
211 requires (not detail::comparable_operands<
214 ge ([[maybe_unused]] Lhs_T&& lhs, [[maybe_unused]] Rhs_T&& rhs)
230 template <
class Lhs_T,
class Rhs_T>
234 lt (Lhs_T&& lhs, Rhs_T&& rhs)
241#if !defined(__DOXYGEN__)
247 template <
class Lhs_T,
class Rhs_T>
251 lt ([[maybe_unused]] Lhs_T&& lhs, [[maybe_unused]] Rhs_T&& rhs)
266 template <
class Lhs_T,
class Rhs_T>
270 le (Lhs_T&& lhs, Rhs_T&& rhs)
277#if !defined(__DOXYGEN__)
283 template <
class Lhs_T,
class Rhs_T>
287 le ([[maybe_unused]] Lhs_T&& lhs, [[maybe_unused]] Rhs_T&& rhs)
301 template <
class Lhs_T,
class Rhs_T,
class Epsilon_T>
302 requires (extension::approx_operand<Lhs_T>
303 and extension::approx_operand<Rhs_T>
304 and extension::approx_operand<Epsilon_T>)
306 approx (Lhs_T&& lhs, Rhs_T&& rhs, Epsilon_T&& epsilon)
309 std::forward<Rhs_T> (rhs),
310 std::forward<Epsilon_T> (epsilon) };
327 template <
class Expr_T>
328 requires extension::checkable<std::remove_cvref_t<Expr_T>>
333 std::forward<Expr_T> (expr)
355 template <
class First_T,
class Second_T,
class... Rest_T>
356 requires (extension::checkable<std::remove_cvref_t<First_T>>
357 and extension::checkable<std::remove_cvref_t<Second_T>>
358 and (extension::checkable<std::remove_cvref_t<Rest_T>> and ...))
360 all_of (First_T&& first, Second_T&& second, Rest_T&&... rest)
362 if constexpr (
sizeof...(Rest_T) == 0)
365 std::forward<Second_T> (second) };
371 std::forward<Second_T> (second) },
372 std::forward<Rest_T> (rest)...);
390 template <
class First_T,
class Second_T,
class... Rest_T>
391 requires (extension::checkable<std::remove_cvref_t<First_T>>
392 and extension::checkable<std::remove_cvref_t<Second_T>>
393 and (extension::checkable<std::remove_cvref_t<Rest_T>> and ...))
395 any_of (First_T&& first, Second_T&& second, Rest_T&&... rest)
397 if constexpr (
sizeof...(Rest_T) == 0)
400 std::forward<Second_T> (second) };
406 std::forward<Second_T> (second) },
407 std::forward<Rest_T> (rest)...);
415#pragma GCC diagnostic pop
Concept satisfied when the operands of a comparator can be written and compared.
constexpr auto 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.
constexpr auto eq(Lhs_T &&lhs, Rhs_T &&rhs)
Generic equality comparator.
constexpr auto lt(Lhs_T &&lhs, Rhs_T &&rhs)
Generic less than comparator.
constexpr auto ge(Lhs_T &&lhs, Rhs_T &&rhs)
Generic greater than or equal comparator.
constexpr auto gt(Lhs_T &&lhs, Rhs_T &&rhs)
Generic greater than comparator.
constexpr auto le(Lhs_T &&lhs, Rhs_T &&rhs)
Generic less than or equal comparator.
constexpr auto ne(Lhs_T &&lhs, Rhs_T &&rhs)
Generic non-equality comparator.
constexpr auto all_of(First_T &&first, Second_T &&second, Rest_T &&... rest)
Generic logical and operation, for two or more operands.
constexpr auto any_of(First_T &&first, Second_T &&second, Rest_T &&... rest)
Generic logical (inclusive) or operation, for two or more operands.
constexpr auto negate(Expr_T &&expr)
Generic logical not operation.
constexpr auto as_operand(T &&t) noexcept -> decltype(auto)
Prepares an operand of a comparator.
constexpr void reject_comparison(void) noexcept
Stops the compilation of a comparator whose operands are rejected, with a message that tells why.
@ equal
The == operator, checked by eq().
@ greater_equal
The >= operator, checked by ge().
@ less_equal
The <= operator, checked by le().
@ greater
The > operator, checked by gt().
@ not_equal
The != operator, checked by ne().
@ less
The < operator, checked by lt().
Primary namespace for the µTest++ testing framework.
Logical AND comparator struct template.
Approximate comparator struct template.
Relational comparator struct template.
Equality tag for compare_op.
Greater than or equal tag for compare_op.
Greater than tag for compare_op.
Less than or equal tag for compare_op.
Less than tag for compare_op.
Non-equality tag for compare_op.
Logical NOT comparator struct template.
Logical OR comparator struct template.