The deferred_reporter_base
Class Reference
Base class for a deferred reporter that collects messages into a string. More...
Declaration
class micro_os_plus::micro_test_plus::detail::deferred_reporter_base
Included Headers
#include <micro-os-plus/micro-test-plus.h>
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 | |
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.
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.
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.
Public Member Functions
value()
| inlinenodiscardconstexpr |
Protected Member Attributes
abort_
| protected |
location_
| protected |
message_
| protected |
value_
The documentation for this class was generated from the following files:
Generated via docusaurus-plugin-doxygen by Doxygen 1.14.0.