|
micro-test-plus 6.0.0
µTest++ Testing Framework
|
Common base struct for callable-wrapping operators. More...
#include "micro-os-plus/micro-test-plus.h"
Public Types | |
| using | op_type = op |
| Marker identifying the framework expression types. | |
Public Member Functions | |
| callable_op (callable_result &&result) | |
| Constructs a callable operator with the pre-computed result. | |
| constexpr | operator bool () const |
| Conversion operator to boolean. | |
| throw_outcome | outcome (void) const noexcept |
| Retrieves what the invocation threw. | |
| const std::string & | what (void) const noexcept |
| Retrieves the what() of the std::exception thrown. | |
Private Attributes | |
| throw_outcome | outcome_ { throw_outcome::none } |
| Stores what the invocation threw, when the check failed. | |
| const bool | value_ {} |
| Stores the result of the callable invocation. | |
| std::string | what_ {} |
| Stores the what() of the std::exception thrown, when the check failed. | |
The base of the exception-checking operators, throws_op and nothrow_op, which invoke the callable in their constructors. It stores the pre-computed boolean result, and, when the check failed, what was thrown, so that the report can state why (see expression_formatter::append_throw_reason()).
|
inherited |
Detected by the extension::is_op concept, and inherited by all types derived from op.
Definition at line 128 of file extension.h.
|
inlineexplicit |
| result | The result of the invocation, with what was thrown. |
Stores the pre-computed boolean result, and, when the check failed, what the invocation threw and the what() of the exception.
Definition at line 1125 of file detail-inlines.h.
References outcome(), outcome_, value_, what(), and what_.
Referenced by micro_os_plus::micro_test_plus::detail::nothrow_op::nothrow_op(), micro_os_plus::micro_test_plus::detail::throws_op< Exception_T >::throws_op(), and micro_os_plus::micro_test_plus::detail::throws_op< void >::throws_op().
|
nodiscardconstexpr |
Returns the result computed by the constructor of the derived operator; the callable is not invoked again.
Definition at line 1136 of file detail-inlines.h.
References value_.
|
inlinenodiscardnoexcept |
Returns what was recorded when the check failed.
Definition at line 1147 of file detail-inlines.h.
References outcome_.
Referenced by callable_op().
|
inlinenodiscardnoexcept |
Returns the text recorded when a std::exception was thrown.
Definition at line 1157 of file detail-inlines.h.
References what_.
Referenced by callable_op().
|
private |
Copied from the callable_result by the constructor.
Definition at line 1461 of file detail.h.
Referenced by callable_op(), and outcome().
|
private |
Computed once, by the derived operator constructor, which invokes the callable.
Definition at line 1453 of file detail.h.
Referenced by callable_op(), and operator bool().
|
private |
Moved from the callable_result by the constructor; empty in the usual case, so nothing is allocated.
Definition at line 1471 of file detail.h.
Referenced by callable_op(), and what().