function-comparators.h File
C++ header file with declarations for the µTest++ function comparators. More...
Included Headers
Namespaces Index
| namespace | micro_os_plus |
|
The primary namespace for the µOS++ framework. More... | |
| namespace | micro_test_plus |
|
Primary namespace for the µTest++ testing framework. More... | |
Functions Index
template <class First_T, class Second_T, class... Rest_T> | |
| constexpr auto | all_of (First_T &&first, Second_T &&second, Rest_T &&... rest) |
|
Generic logical and operation, for two or more operands. More... | |
template <class First_T, class Second_T, class... Rest_T> | |
| constexpr auto | any_of (First_T &&first, Second_T &&second, Rest_T &&... rest) |
|
Generic logical (inclusive) or operation, for two or more operands. More... | |
template <class Lhs_T, class Rhs_T, class Epsilon_T> | |
| constexpr auto | approx (Lhs_T &&lhs, Rhs_T &&rhs, Epsilon_T &&epsilon) |
|
Approximate equality comparator, with an explicit tolerance. More... | |
template <class Lhs_T, class Rhs_T> | |
| constexpr auto | eq (Lhs_T &&lhs, Rhs_T &&rhs) |
|
Generic equality comparator. More... | |
template <class Lhs_T, class Rhs_T> | |
| constexpr auto | ge (Lhs_T &&lhs, Rhs_T &&rhs) |
|
Generic greater than or equal comparator. More... | |
template <class Lhs_T, class Rhs_T> | |
| constexpr auto | gt (Lhs_T &&lhs, Rhs_T &&rhs) |
|
Generic greater than comparator. More... | |
template <class Lhs_T, class Rhs_T> | |
| constexpr auto | le (Lhs_T &&lhs, Rhs_T &&rhs) |
|
Generic less than or equal comparator. More... | |
template <class Lhs_T, class Rhs_T> | |
| constexpr auto | lt (Lhs_T &&lhs, Rhs_T &&rhs) |
|
Generic less than comparator. More... | |
template <class Lhs_T, class Rhs_T> | |
| constexpr auto | ne (Lhs_T &&lhs, Rhs_T &&rhs) |
|
Generic non-equality comparator. More... | |
template <class Expr_T> | |
| constexpr auto | negate (Expr_T &&expr) |
|
Generic logical not operation. More... | |
Description
C++ header file with declarations for the µTest++ function comparators.
This header provides the declarations for the function comparator templates and logical operators used within the µTest++ framework. It defines the interfaces for the generic comparison functions, including equality, non-equality, greater than, less than, greater than or equal, and less than or equal, and the approximate comparison with an explicit tolerance (approx). Additionally, it declares logical combinators such as conjunction (all_of), disjunction (any_of), and negation (negate); their deprecated v5.0.1 names are declared in deprecated.h.
The C strings (the arrays, including the string literals, and the pointers of the character types) are compared by content, and so are the other arrays (e.g. byte buffers), element by element; the other pointers are compared by address. The temporaries are moved into the returned expressions, and the named operands are copied, so an expression can be returned from the function that builds it, and kept after the operands are destroyed, except for the arrays and the characters of the C strings, which are referred to and must outlive the expression. The copy is made for every check, passing or failing, so a large container or string costs an allocation; compare a std::string_view of a string instead, when the cost matters. The logical combinators have descriptive names, since and, or, and not are alternative tokens and cannot be used as identifiers.
All definitions reside within the micro_os_plus::micro_test_plus namespace.
This file is included by micro-os-plus/micro-test-plus.h, which is the header that the applications include.
File Listing
The file content with the documentation metadata removed is:
Generated via doxygen2docusaurus 2.2.8 by Doxygen 1.18.0.