Skip to main content

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

Derived Classes

classdeferred_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 boolvalue () const

Retrieves the result value. More...

Protected Member Attributes Index

boolabort_ = false

Indicates whether the reporting should abort further processing. More...

const reflection::source_locationlocation_ {}

Stores the source location associated with the report. More...

std::stringmessage_ {}

String to collect the expectation message passed via operator<<(). More...

boolvalue_ {}

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()

micro_os_plus::micro_test_plus::detail::deferred_reporter_base::deferred_reporter_base (bool value, const reflection::source_location location)

Constructs a deferred reporter base.

Parameters
valueThe result value associated with the report.
locationThe 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()

micro_os_plus::micro_test_plus::detail::deferred_reporter_base::~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<<()

template <class T>
auto & micro_os_plus::micro_test_plus::detail::deferred_reporter_base::operator<< (const T & msg)

Appends a message to the reporter.

Template Parameters
TThe type of the message to append.
Parameters
msgThe 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()

bool micro_os_plus::micro_test_plus::detail::deferred_reporter_base::value () const
inlinenodiscardconstexpr

Retrieves the result value.

Parameters

None.

Return Values
trueThe reported condition was met.
falseThe reported condition was not met.

Returns the result value associated with the report.

Definition at line 1786 of file detail.h.

Protected Member Attributes

abort_

bool micro_os_plus::micro_test_plus::detail::deferred_reporter_base::abort_ = false
protected

Indicates whether the reporting should abort further processing.

Definition at line 1801 of file detail.h.

location_

const reflection::source_location micro_os_plus::micro_test_plus::detail::deferred_reporter_base::location_ {}
protected

Stores the source location associated with the report.

Definition at line 1806 of file detail.h.

message_

std::string micro_os_plus::micro_test_plus::detail::deferred_reporter_base::message_ {}
protected

String to collect the expectation message passed via operator<<().

Definition at line 1812 of file detail.h.

value_

bool micro_os_plus::micro_test_plus::detail::deferred_reporter_base::value_ {}
protected

Stores the result value of the report.

Definition at line 1795 of file detail.h.


The documentation for this class was generated from the following files:


Generated via docusaurus-plugin-doxygen by Doxygen 1.14.0.