|
micro-test-plus 6.0.0
µTest++ Testing Framework
|
Common base struct template for unary comparators. More...
#include "micro-os-plus/micro-test-plus.h"
Public Types | |
| using | op_type = op |
| Marker identifying the framework expression types. | |
Public Member Functions | |
| template<class U> | |
| constexpr | unary_op (U &&t, bool value) |
| Constructs a unary comparator with the given operand and pre-computed result. | |
| constexpr decltype(auto) | operand (void) const |
| Retrieves the wrapped operand expression. | |
| constexpr | operator bool () const |
| Conversion operator to boolean. | |
Private Attributes | |
| T | t_ |
| Stores the operand. | |
| const bool | value_ {} |
| Stores the result of the operation. | |
This base struct stores a single operand and the pre-computed boolean result of a unary operation. Derived structs such as not_op inherit from this to provide logical negation. The result is computed at construction time, enabling consistent handling and reporting of operations throughout the framework.
| T | The type of the stored operand, either the operand type, or a const reference to it (see stored_operand_t). |
|
inherited |
Detected by the extension::is_op concept, and inherited by all types derived from op.
Definition at line 128 of file extension.h.
|
constexpr |
The operand is forwarded to the member, so that an rvalue is moved, not copied.
| U | The type of the operand argument. |
| t | The operand. |
| value | The pre-computed boolean result of the operation. |
Stores the operand and the pre-computed boolean result of the operation in the corresponding private members.
Definition at line 117 of file detail-inlines.h.
Referenced by micro_os_plus::micro_test_plus::detail::not_op< T >::not_op(), micro_os_plus::micro_test_plus::detail::predicate_op< T, Predicate_T >::predicate_op(), and operator bool().
|
nodiscardconstexpr |
The operand is unwrapped with detail::unwrap() and returned by reference, so that formatting it does not copy it.
Returns the operand, unwrapped by detail::unwrap() if it is a framework wrapper type; the stored operand is not copied.
Definition at line 141 of file detail-inlines.h.
References operand(), t_, and micro_os_plus::micro_test_plus::detail::unwrap().
Referenced by operand().
|
nodiscardconstexpr |
Returns the pre-computed boolean result stored by the derived comparator's constructor.
Definition at line 128 of file detail-inlines.h.
References unary_op(), and value_.
|
private |
A value, moved from a temporary or copied from a named operand, or, for a named operand that cannot be copied, a const reference to it (see stored_operand_t). It is not const, so that a temporary expression can be moved into an enclosing one.
Definition at line 309 of file detail.h.
Referenced by unary_op(), and operand().
|
private |
Computed once, by the derived comparator constructor.
Definition at line 317 of file detail.h.
Referenced by unary_op(), and operator bool().