|
micro-test-plus 5.0.1
µTest++ Testing Framework
|
Functions for comparing actual and expected values in tests. More...
Functions | |
| template<class Lhs_T, class Rhs_T> | |
| constexpr auto | micro_os_plus::micro_test_plus::eq (const Lhs_T &lhs, const Rhs_T &rhs) |
| Generic equality comparator for non-pointer types. | |
| template<class Lhs_T, class Rhs_T> | |
| constexpr auto | micro_os_plus::micro_test_plus::eq (Lhs_T *lhs, Rhs_T *rhs) |
| Pointer equality comparator for any pointer types. | |
| template<class Lhs_T, class Rhs_T> | |
| constexpr auto | micro_os_plus::micro_test_plus::ge (const Lhs_T &lhs, const Rhs_T &rhs) |
| Generic greater than or equal comparator. | |
| template<class Lhs_T, class Rhs_T> | |
| constexpr auto | micro_os_plus::micro_test_plus::ge (Lhs_T *lhs, Rhs_T *rhs) |
| Pointer greater than or equal comparator. | |
| template<class Lhs_T, class Rhs_T> | |
| constexpr auto | micro_os_plus::micro_test_plus::gt (const Lhs_T &lhs, const Rhs_T &rhs) |
| Generic greater than comparator. | |
| template<class Lhs_T, class Rhs_T> | |
| constexpr auto | micro_os_plus::micro_test_plus::gt (Lhs_T *lhs, Rhs_T *rhs) |
| Pointer greater than comparator. | |
| template<class Lhs_T, class Rhs_T> | |
| constexpr auto | micro_os_plus::micro_test_plus::le (const Lhs_T &lhs, const Rhs_T &rhs) |
| Generic less than or equal comparator. | |
| template<class Lhs_T, class Rhs_T> | |
| constexpr auto | micro_os_plus::micro_test_plus::le (Lhs_T *lhs, Rhs_T *rhs) |
| Pointer less than or equal comparator. | |
| template<class Lhs_T, class Rhs_T> | |
| constexpr auto | micro_os_plus::micro_test_plus::lt (const Lhs_T &lhs, const Rhs_T &rhs) |
| Generic less than comparator. | |
| template<class Lhs_T, class Rhs_T> | |
| constexpr auto | micro_os_plus::micro_test_plus::lt (Lhs_T *lhs, Rhs_T *rhs) |
| Pointer less than comparator. | |
| template<class Lhs_T, class Rhs_T> | |
| constexpr auto | micro_os_plus::micro_test_plus::ne (const Lhs_T &lhs, const Rhs_T &rhs) |
| Generic non-equality comparator. | |
| template<class Lhs_T, class Rhs_T> | |
| constexpr auto | micro_os_plus::micro_test_plus::ne (Lhs_T *lhs, Rhs_T *rhs) |
| Pointer non-equality comparator. | |
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.
If a comparator check fails, the output clearly indicates the actual and expected values:
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.
|
nodiscardconstexpr |
| Lhs_T | Type of the left hand side operand. |
| Rhs_T | Type of the right hand side operand. |
| lhs | Left hand side operand. |
| rhs | Right hand side operand. |
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 84 of file function-comparators-inlines.h.
|
nodiscardconstexpr |
| Lhs_T | Type of the left hand side pointer operand. |
| Rhs_T | Type of the right hand side pointer operand. |
| lhs | Left hand side pointer operand. |
| rhs | Right hand side pointer operand. |
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 99 of file function-comparators-inlines.h.
|
nodiscardconstexpr |
| Lhs_T | Type of the left hand side operand. |
| Rhs_T | Type of the right hand side operand. |
| lhs | Left hand side operand. |
| rhs | Right hand side operand. |
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 174 of file function-comparators-inlines.h.
|
nodiscardconstexpr |
| Lhs_T | Type of the left hand side pointer operand. |
| Rhs_T | Type of the right hand side pointer operand. |
| lhs | Left hand side pointer operand. |
| rhs | Right hand side pointer operand. |
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 190 of file function-comparators-inlines.h.
|
nodiscardconstexpr |
| Lhs_T | Type of the left hand side operand. |
| Rhs_T | Type of the right hand side operand. |
| lhs | Left hand side operand. |
| rhs | Right hand side operand. |
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 144 of file function-comparators-inlines.h.
|
nodiscardconstexpr |
| Lhs_T | Type of the left hand side pointer operand. |
| Rhs_T | Type of the right hand side pointer operand. |
| lhs | Left hand side pointer operand. |
| rhs | Right hand side pointer operand. |
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 159 of file function-comparators-inlines.h.
|
nodiscardconstexpr |
| Lhs_T | Type of the left hand side operand. |
| Rhs_T | Type of the right hand side operand. |
| lhs | Left hand side operand. |
| rhs | Right hand side operand. |
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 235 of file function-comparators-inlines.h.
|
nodiscardconstexpr |
| Lhs_T | Type of the left hand side pointer operand. |
| Rhs_T | Type of the right hand side pointer operand. |
| lhs | Left hand side pointer operand. |
| rhs | Right hand side pointer operand. |
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 251 of file function-comparators-inlines.h.
|
nodiscardconstexpr |
| Lhs_T | Type of the left hand side operand. |
| Rhs_T | Type of the right hand side operand. |
| lhs | Left hand side operand. |
| rhs | Right hand side operand. |
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 205 of file function-comparators-inlines.h.
|
nodiscardconstexpr |
| Lhs_T | Type of the left hand side pointer operand. |
| Rhs_T | Type of the right hand side pointer operand. |
| lhs | Left hand side pointer operand. |
| rhs | Right hand side pointer operand. |
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 220 of file function-comparators-inlines.h.
|
nodiscardconstexpr |
| Lhs_T | Type of the left hand side operand. |
| Rhs_T | Type of the right hand side operand. |
| lhs | Left hand side operand. |
| rhs | Right hand side operand. |
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 114 of file function-comparators-inlines.h.
|
nodiscardconstexpr |
| Lhs_T | Type of the left hand side pointer operand. |
| Rhs_T | Type of the right hand side pointer operand. |
| lhs | Left hand side pointer operand. |
| rhs | Right hand side pointer operand. |
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 129 of file function-comparators-inlines.h.