The deferred_reporter_base
Class Reference
Base class for a deferred reporter that collects messages into a string. More...
Declaration
Included Headers
Derived Classes
class | deferred_reporter<Expr_T> |
Deferred reporter class template for a specific expression. More... | |
Public Constructors Index
deferred_reporter_base (bool value, const reflection::source_location location) | |
Constructs a deferred reporter base. More... | |
Public Destructor Index
~deferred_reporter_base () | |
Destructor for the deferred reporter base. More... | |
Public Operators Index
template <class T> | |
auto & | operator<< (const T &msg) |
Appends a message to the reporter. More... | |
Public Member Functions Index
constexpr bool | value () const |
Retrieves the result value. More... | |
Protected Member Attributes Index
bool | abort_ = false |
Indicates whether the reporting should abort further processing. More... | |
const reflection::source_location | location_ {} |
Stores the source location associated with the report. More... | |
std::string | message_ {} |
String to collect the expectation message passed via operator<<(). More... | |
bool | value_ {} |
Stores the result value of the report. More... | |
Description
Base class for a deferred reporter that collects messages into a string.
The deferred_reporter_base class serves as the foundational component for deferred reporting within the framework. It is responsible for collecting expectation messages, typically passed via the operator<<(), into a string for later reporting.
This class maintains the result value, abort status, and the source location associated with the report. It is intended exclusively for internal use and is implemented in the include/micro-os-plus/micro-test-plus folder to ensure a structured and modular codebase.
Definition at line 1744 of file detail.h.
Public Constructors
deferred_reporter_base()
|
Constructs a deferred reporter base.
- Parameters
-
value The result value associated with the report.
location The source location relevant to the report.
This constructor updates the current test suite's statistics based on the outcome of the test expression. If the evaluated value is true, the count of successful tests is incremented; otherwise, the count of failed tests is incremented. The source location is recorded for reporting purposes, enabling precise identification of the test case within the relevant file or folder.
Declaration at line 1753 of file detail.h, definition at line 218 of file micro-test-plus.cpp.
References micro_os_plus::micro_test_plus::current_test_suite, location_, value and value_.
Referenced by micro_os_plus::micro_test_plus::detail::deferred_reporter< Expr_T >::deferred_reporter.
Public Destructor
~deferred_reporter_base()
|
Destructor for the deferred reporter base.
The destructor ensures that if an abort condition is set and the test expression has failed, the test output is flushed and the process is terminated. This mechanism guarantees immediate feedback and halts further execution upon critical test failures, aiding in rapid identification and resolution of issues during test runs.
Declaration at line 1759 of file detail.h, definition at line 240 of file micro-test-plus.cpp.
References abort_, micro_os_plus::micro_test_plus::reporter and value_.
Public Operators
operator<<()
|
Appends a message to the reporter.
- Template Parameters
-
T The type of the message to append.
- Parameters
-
msg The message to append.
- Returns
Reference to the current reporter instance.
This operator overload enables the deferred reporter to accumulate expectation messages by appending the provided value to the internal message string.
If the argument is of an arithmetic type, it is first converted to a string using std::to_string before being appended. For all other types, the value is appended directly. This ensures that both numeric and string-like messages are handled appropriately and consistently.
Declaration at line 1770 of file detail.h, definition at line 90 of file details-inlines.h.
Reference message_.
Public Member Functions
value()
| inline nodiscard constexpr |
Retrieves the result value.
- Parameters
None.
- Return Values
-
true The reported condition was met.
false The reported condition was not met.
Returns the result value associated with the report.
Definition at line 1786 of file detail.h.
Reference value_.
Referenced by deferred_reporter_base.
Protected Member Attributes
abort_
| protected |
Indicates whether the reporting should abort further processing.
Definition at line 1801 of file detail.h.
Referenced by micro_os_plus::micro_test_plus::detail::deferred_reporter< Expr_T >::deferred_reporter, micro_os_plus::micro_test_plus::detail::deferred_reporter< Expr_T >::~deferred_reporter and ~deferred_reporter_base.
location_
| protected |
Stores the source location associated with the report.
Definition at line 1806 of file detail.h.
Referenced by deferred_reporter_base and micro_os_plus::micro_test_plus::detail::deferred_reporter< Expr_T >::~deferred_reporter.
message_
| protected |
String to collect the expectation message passed via operator<<().
Definition at line 1812 of file detail.h.
Referenced by micro_os_plus::micro_test_plus::detail::deferred_reporter< Expr_T >::~deferred_reporter and operator<<.
value_
| protected |
Stores the result value of the report.
Definition at line 1795 of file detail.h.
Referenced by deferred_reporter_base, micro_os_plus::micro_test_plus::detail::deferred_reporter< Expr_T >::~deferred_reporter, ~deferred_reporter_base and value.
The documentation for this class was generated from the following files:
Generated via doxygen2docusaurus by Doxygen 1.14.0.