Function Comparators
Functions for comparing actual and expected values in tests. More...
Functions Index
template <class Lhs_T, class Rhs_T> | |
| constexpr auto | eq (const Lhs_T &lhs, const Rhs_T &rhs) |
|
Generic equality comparator for non-pointer types. More... | |
template <class Lhs_T, class Rhs_T> | |
| constexpr auto | eq (Lhs_T *lhs, Rhs_T *rhs) |
|
Pointer equality comparator for any pointer types. More... | |
template <class Lhs_T, class Rhs_T> | |
| constexpr auto | ge (const Lhs_T &lhs, const Rhs_T &rhs) |
|
Generic greater than or equal comparator. More... | |
template <class Lhs_T, class Rhs_T> | |
| constexpr auto | ge (Lhs_T *lhs, Rhs_T *rhs) |
|
Pointer greater than or equal comparator. More... | |
template <class Lhs_T, class Rhs_T> | |
| constexpr auto | gt (const Lhs_T &lhs, const Rhs_T &rhs) |
|
Generic greater than comparator. More... | |
template <class Lhs_T, class Rhs_T> | |
| constexpr auto | gt (Lhs_T *lhs, Rhs_T *rhs) |
|
Pointer greater than comparator. More... | |
template <class Lhs_T, class Rhs_T> | |
| constexpr auto | le (const Lhs_T &lhs, const Rhs_T &rhs) |
|
Generic less than or equal comparator. More... | |
template <class Lhs_T, class Rhs_T> | |
| constexpr auto | le (Lhs_T *lhs, Rhs_T *rhs) |
|
Pointer less than or equal comparator. More... | |
template <class Lhs_T, class Rhs_T> | |
| constexpr auto | lt (const Lhs_T &lhs, const Rhs_T &rhs) |
|
Generic less than comparator. More... | |
template <class Lhs_T, class Rhs_T> | |
| constexpr auto | lt (Lhs_T *lhs, Rhs_T *rhs) |
|
Pointer less than comparator. More... | |
template <class Lhs_T, class Rhs_T> | |
| constexpr auto | ne (const Lhs_T &lhs, const Rhs_T &rhs) |
|
Generic non-equality comparator. More... | |
template <class Lhs_T, class Rhs_T> | |
| constexpr auto | ne (Lhs_T *lhs, Rhs_T *rhs) |
|
Pointer non-equality comparator. More... | |
Description
Functions for comparing actual and expected values in tests.
While any boolean expression can be used in expectations and assumptions, dedicated comparator functions such as eq, ne, lt, le, gt, and ge provide enhanced reporting by explicitly showing the compared values when a check fails.
Using these comparators ensures that failed checks report both actual and expected values, making issues easier to diagnose.
Comparators are available for both fundamental types and standard containers. When comparing containers, each element is assessed individually, and the results are reported in detail.
- Examples
If a comparator check fails, the output clearly indicates the actual and expected values:
- Comparing Containers
Containers can be compared for equality or inequality using the same comparator functions. Comparison is performed by iterating through each element and evaluating it individually.
- Examples
Functions
eq()
| nodiscard constexpr |
Generic equality comparator for non-pointer types.
- Template Parameters
-
Lhs_T Type of the left hand side operand.
Rhs_T Type of the right hand side operand.
- Parameters
-
[in] lhs Left hand side operand.
[in] rhs Right hand side operand.
- Returns
A comparator object that evaluates to true if the operands are equal.
The eq function template provides a generic equality comparator for any non-pointer types. It constructs a comparator object that can be used within the µTest++ framework to assert that two values are equal. This function is typically used in test expectations and assertions to compare the actual and expected values.
Definition at line 83 of file function-comparators-inlines.h.
eq()
| nodiscard constexpr |
Pointer equality comparator for any pointer types.
- Template Parameters
-
Lhs_T Type of the left hand side pointer operand.
Rhs_T Type of the right hand side pointer operand.
- Parameters
-
[in] lhs Left hand side pointer operand.
[in] rhs Right hand side pointer operand.
- Returns
A comparator object that evaluates to true if the pointers are equal.
The eq function template provides a pointer equality comparator for any pointer types. It constructs a comparator object that can be used within the µTest++ framework to assert that two pointers are equal. This function is typically used in test expectations and assertions to compare the addresses of objects or resources.
Definition at line 98 of file function-comparators-inlines.h.
ge()
| nodiscard constexpr |
Generic greater than or equal comparator.
- Template Parameters
-
Lhs_T Type of the left hand side operand.
Rhs_T Type of the right hand side operand.
- Parameters
-
[in] lhs Left hand side operand.
[in] rhs Right hand side operand.
- Returns
A comparator object that evaluates to true if lhs is greater than or equal to rhs.
The ge function template provides a generic greater than or equal comparator for any types. It constructs a comparator object that can be used within the µTest++ framework to assert that one value is greater than or equal to another. This function is typically used in test expectations and assertions to compare the actual and expected values.
Definition at line 173 of file function-comparators-inlines.h.
ge()
| nodiscard constexpr |
Pointer greater than or equal comparator.
- Template Parameters
-
Lhs_T Type of the left hand side pointer operand.
Rhs_T Type of the right hand side pointer operand.
- Parameters
-
[in] lhs Left hand side pointer operand.
[in] rhs Right hand side pointer operand.
- Returns
A comparator object that evaluates to true if the left hand side pointer is greater than or equal to the right hand side pointer.
The ge function template provides a pointer greater than or equal comparator for any pointer types. It constructs a comparator object that can be used within the µTest++ framework to assert that one pointer is greater than or equal to another. This function is typically used in test expectations and assertions to compare the addresses of objects or resources.
Definition at line 189 of file function-comparators-inlines.h.
gt()
| nodiscard constexpr |
Generic greater than comparator.
- Template Parameters
-
Lhs_T Type of the left hand side operand.
Rhs_T Type of the right hand side operand.
- Parameters
-
[in] lhs Left hand side operand.
[in] rhs Right hand side operand.
- Returns
A comparator object that evaluates to true if lhs is greater than rhs.
The gt function template provides a generic greater than comparator for any types. It constructs a comparator object that can be used within the µTest++ framework to assert that one value is greater than another. This function is typically used in test expectations and assertions to compare the actual and expected values.
Definition at line 143 of file function-comparators-inlines.h.
gt()
| nodiscard constexpr |
Pointer greater than comparator.
- Template Parameters
-
Lhs_T Type of the left hand side pointer operand.
Rhs_T Type of the right hand side pointer operand.
- Parameters
-
[in] lhs Left hand side pointer operand.
[in] rhs Right hand side pointer operand.
- Returns
A comparator object that evaluates to true if the left hand side pointer is greater than the right hand side pointer.
The gt function template provides a pointer greater than comparator for any pointer types. It constructs a comparator object that can be used within the µTest++ framework to assert that one pointer is greater than another. This function is typically used in test expectations and assertions to compare the addresses of objects or resources.
Definition at line 158 of file function-comparators-inlines.h.
le()
| nodiscard constexpr |
Generic less than or equal comparator.
- Template Parameters
-
Lhs_T Type of the left hand side operand.
Rhs_T Type of the right hand side operand.
- Parameters
-
[in] lhs Left hand side operand.
[in] rhs Right hand side operand.
- Returns
A comparator object that evaluates to true if lhs is less than or equal to rhs.
The le function template provides a generic less than or equal comparator for any types. It constructs a comparator object that can be used within the µTest++ framework to assert that one value is less than or equal to another. This function is typically used in test expectations and assertions to compare the actual and expected values.
Definition at line 234 of file function-comparators-inlines.h.
le()
| nodiscard constexpr |
Pointer less than or equal comparator.
- Template Parameters
-
Lhs_T Type of the left hand side pointer operand.
Rhs_T Type of the right hand side pointer operand.
- Parameters
-
[in] lhs Left hand side pointer operand.
[in] rhs Right hand side pointer operand.
- Returns
A comparator object that evaluates to true if the left hand side pointer is less than or equal to the right hand side pointer.
The le function template provides a pointer less than or equal comparator for any pointer types. It constructs a comparator object that can be used within the µTest++ framework to assert that one pointer is less than or equal to another. This function is typically used in test expectations and assertions to compare the addresses of objects or resources.
Definition at line 250 of file function-comparators-inlines.h.
lt()
| nodiscard constexpr |
Generic less than comparator.
- Template Parameters
-
Lhs_T Type of the left hand side operand.
Rhs_T Type of the right hand side operand.
- Parameters
-
[in] lhs Left hand side operand.
[in] rhs Right hand side operand.
- Returns
A comparator object that evaluates to true if lhs is less than rhs.
The lt function template provides a generic less than comparator for any types. It constructs a comparator object that can be used within the µTest++ framework to assert that one value is less than another. This function is typically used in test expectations and assertions to compare the actual and expected values.
Definition at line 204 of file function-comparators-inlines.h.
lt()
| nodiscard constexpr |
Pointer less than comparator.
- Template Parameters
-
Lhs_T Type of the left hand side pointer operand.
Rhs_T Type of the right hand side pointer operand.
- Parameters
-
[in] lhs Left hand side pointer operand.
[in] rhs Right hand side pointer operand.
- Returns
A comparator object that evaluates to true if the left hand side pointer is less than the right hand side pointer.
The lt function template provides a pointer less than comparator for any pointer types. It constructs a comparator object that can be used within the µTest++ framework to assert that one pointer is less than another. This function is typically used in test expectations and assertions to compare the addresses of objects or resources.
Definition at line 219 of file function-comparators-inlines.h.
ne()
| nodiscard constexpr |
Generic non-equality comparator.
- Template Parameters
-
Lhs_T Type of the left hand side operand.
Rhs_T Type of the right hand side operand.
- Parameters
-
[in] lhs Left hand side operand.
[in] rhs Right hand side operand.
- Returns
A comparator object that evaluates to true if the operands are not equal.
The ne function template provides a generic non-equality comparator for any types. It constructs a comparator object that can be used within the µTest++ framework to assert that two values are not equal. This function is typically used in test expectations and assertions to compare the actual and expected values.
Definition at line 113 of file function-comparators-inlines.h.
ne()
| nodiscard constexpr |
Pointer non-equality comparator.
- Template Parameters
-
Lhs_T Type of the left hand side pointer operand.
Rhs_T Type of the right hand side pointer operand.
- Parameters
-
[in] lhs Left hand side pointer operand.
[in] rhs Right hand side pointer operand.
- Returns
A comparator object that evaluates to true if the pointers are not equal.
The ne function template provides a pointer non-equality comparator for any pointer types. It constructs a comparator object that can be used within the µTest++ framework to assert that two pointers are not equal. This function is typically used in test expectations and assertions to compare the addresses of objects or resources.
Definition at line 128 of file function-comparators-inlines.h.
Generated via doxygen2docusaurus 2.2.0 by Doxygen 1.17.0.