micro-test-plus 3.2.2
µTest++ Testing Framework
Loading...
Searching...
No Matches
micro_os_plus::micro_test_plus::detail::eq_< Lhs_T, Rhs_T > Struct Template Reference

Equality comparator struct template. More...

#include <micro-os-plus/micro-test-plus.h>

Inheritance diagram for micro_os_plus::micro_test_plus::detail::eq_< Lhs_T, Rhs_T >:

Public Member Functions

constexpr eq_ (const Lhs_T &lhs={}, const Rhs_T &rhs={})
 Constructs an equality comparator for the given operands.
constexpr auto lhs (void) const
 Retrieves the left-hand operand.
constexpr operator bool () const
 Conversion operator to boolean.
constexpr auto rhs (void) const
 Retrieves the right-hand operand.

Public Attributes

const Lhs_T lhs_ {}
 Stores the left-hand operand.
const Rhs_T rhs_ {}
 Stores the right-hand operand.
const bool value_ {}
 Stores the result of the equality comparison.

Detailed Description

template<class Lhs_T, class Rhs_T>
struct micro_os_plus::micro_test_plus::detail::eq_< Lhs_T, Rhs_T >
Template Parameters
Lhs_TThe type of the left-hand operand.
Rhs_TThe type of the right-hand operand.

The eq_ struct template provides a type-safe mechanism for evaluating equality between two operands within the framework.

This comparator supports a variety of operand types, including those with static values, types with precision (epsilon), and generic types. For types with static values, the comparison is performed directly. For types supporting precision, the comparison accounts for the smallest epsilon to ensure accuracy, particularly for floating-point types. For all other types, the generic getter is used to retrieve and compare the values.

The implementation is optimised for use in embedded environments and supports both compile-time and run-time evaluation.

All definitions are intended for internal use within the framework and are implemented in the include/micro-os-plus/micro-test-plus folder to maintain a structured and modular codebase.

Definition at line 259 of file detail.h.

Constructor & Destructor Documentation

◆ eq_()

template<class Lhs_T, class Rhs_T>
micro_os_plus::micro_test_plus::detail::eq_< Lhs_T, Rhs_T >::eq_ ( const Lhs_T & lhs = {},
const Rhs_T & rhs = {} )
inlineconstexpr
Parameters
lhsThe left-hand operand.
rhsThe right-hand operand.

Evaluates the equality of the provided operands at construction, supporting static values, types with precision, and generic types. The result is stored in the value_ member for efficient access.

Definition at line 272 of file detail.h.

Member Function Documentation

◆ lhs()

template<class Lhs_T, class Rhs_T>
auto micro_os_plus::micro_test_plus::detail::eq_< Lhs_T, Rhs_T >::lhs ( void ) const
inlinenodiscardconstexpr
Parameters
None.
Returns
The extracted left-hand operand.

Returns the value of the left-hand operand, applying the generic getter to ensure correct extraction for both custom and standard types.

Definition at line 358 of file detail.h.

◆ operator bool()

template<class Lhs_T, class Rhs_T>
micro_os_plus::micro_test_plus::detail::eq_< Lhs_T, Rhs_T >::operator bool ( ) const
inlinenodiscardconstexpr
Parameters
None.
Return values
trueThe operands are considered equal.
falseThe operands are not equal.

Returns the result of the equality comparison.

Definition at line 340 of file detail.h.

◆ rhs()

template<class Lhs_T, class Rhs_T>
auto micro_os_plus::micro_test_plus::detail::eq_< Lhs_T, Rhs_T >::rhs ( void ) const
inlinenodiscardconstexpr
Parameters
None.
Returns
The extracted right-hand operand.

Returns the value of the right-hand operand, applying the generic getter to ensure correct extraction for both custom and standard types.

Definition at line 376 of file detail.h.

Member Data Documentation

◆ lhs_

template<class Lhs_T, class Rhs_T>
const Lhs_T micro_os_plus::micro_test_plus::detail::eq_< Lhs_T, Rhs_T >::lhs_ {}

Definition at line 384 of file detail.h.

◆ rhs_

template<class Lhs_T, class Rhs_T>
const Rhs_T micro_os_plus::micro_test_plus::detail::eq_< Lhs_T, Rhs_T >::rhs_ {}

Definition at line 389 of file detail.h.

◆ value_

template<class Lhs_T, class Rhs_T>
const bool micro_os_plus::micro_test_plus::detail::eq_< Lhs_T, Rhs_T >::value_ {}

Definition at line 394 of file detail.h.


The documentation for this struct was generated from the following file: