|
micro-test-plus 6.0.0
µTest++ Testing Framework
|
Struct representing a named boolean constant, created by the _b literal. More...
#include "micro-os-plus/micro-test-plus.h"
Public Types | |
| using | op_type = op |
| Marker identifying the framework expression types. | |
| using | value_type = bool |
| The type of the value. | |
Public Member Functions | |
| constexpr | named_bool (std::string_view name) noexcept |
| Constructs a named boolean constant with the given name. | |
| constexpr std::string_view | name (void) const noexcept |
| Returns the name of the constant. | |
| constexpr | operator value_type () const noexcept |
| Conversion operator to bool. | |
Private Attributes | |
| std::string_view | name_ |
| The name of the constant. | |
The named_bool struct holds the constant true, together with a name, which the expression formatter prints instead of the value, so that a failed comparison like "flag"_b == flag, with the operators in the operators namespace, is reported as flag == false.
The value is available only via the implicit conversion to bool, and the struct has neither a get() accessor nor comparison operators. Thus detail::unwrap() returns the object itself, so that the formatter receives the name, the comparators compare it as the bool value true, and the generic operators in the operators namespace, not a better matching operator of this struct, are selected for it.
The name is not owned; it refers to the string literal, which has static storage duration.
Definition at line 743 of file deprecated.h.
|
inherited |
Detected by the extension::is_op concept, and inherited by all types derived from op.
Definition at line 128 of file extension.h.
The named literal behaves as a boolean value.
Definition at line 751 of file deprecated.h.
|
explicitconstexprnoexcept |
| name | The name, printed in place of the value. |
Stores the view of the name; the characters are not copied.
Definition at line 647 of file deprecated-inlines.h.
|
nodiscardconstexprnoexcept |
Returns the stored view of the name.
Definition at line 667 of file deprecated-inlines.h.
References name_.
Referenced by named_bool(), and micro_os_plus::micro_test_plus::detail::expression_formatter::operator<<().
|
nodiscardconstexprnoexcept |
Always returns true, the value of all named boolean constants.
Definition at line 656 of file deprecated-inlines.h.
|
private |
Not owned; refers to the characters of the string literal.
Definition at line 787 of file deprecated.h.
Referenced by named_bool(), and name().