|
micro-test-plus 4.1.0
µTest++ Testing Framework
|
Generic strongly-typed wrapper for explicit type conversion. More...
#include <micro-os-plus/micro-test-plus.h>
Public Types | |
| using | value_type = T |
| The type of the stored value. | |
Public Member Functions | |
| constexpr | to_t (const T &t) |
| Constructor for the strongly-typed wrapper. | |
| constexpr T | get (void) const noexcept |
| Getter for the stored value. | |
| constexpr | operator T () const noexcept |
| Explicit conversion operator to the underlying value type. | |
Public Attributes | |
| T | epsilon = T{} |
| The epsilon value used for floating-point comparisons. | |
| T | value_ {} |
| The stored value. | |
The to_t template provides a public, strongly-typed wrapper for any type T, enabling explicit conversion of dynamic values and expressions to a type recognised by the µTest++ comparators and reporting mechanisms.
This wrapper inherits from type_traits::value<T>, ensuring that the encapsulated value is treated as the specified type within the framework. It is particularly useful for enhancing type safety and clarity in test expressions, especially when working with user-defined or less common types.
Example
This file is intended solely for internal use within the framework and should not be included directly by user code.
Definition at line 877 of file literals.h.
|
inherited |
Definition at line 514 of file type-traits.h.
|
nodiscardconstexprnoexceptinherited |
Returns the stored value by value.
Definition at line 94 of file type-traits-inlines.h.
References value_.
Referenced by micro_os_plus::micro_test_plus::detail::expression_formatter::operator<<().
|
explicitnodiscardconstexprnoexceptinherited |
Allows explicit conversion to the encapsulated value.
Definition at line 82 of file type-traits-inlines.h.
References value_base_(), and value_.
|
inherited |
This instance member defines the precision for comparisons. It is set via the constructor, either explicitly or computed as a default based on the number of decimal digits in the value. Each instance carries its own epsilon, so two value<T> objects with different precisions do not interfere with each other.
Definition at line 753 of file type-traits.h.
|
inherited |
Definition at line 544 of file type-traits.h.
Referenced by value_base_(), get(), and operator T().