mimic++ v9.2.1
Loading...
Searching...
No Matches
mimicpp::reporting::IReporter Class Referenceabstract

The reporter interface. More...

#include <IReporter.hpp>

Inheritance diagram for mimicpp::reporting::IReporter:
[legend]

Public Member Functions

virtual ~IReporter ()=default
 Defaulted virtual destructor.
 
virtual void report_no_matches (CallReport call, std::vector< NoMatchReport > noMatchReports)=0
 Expects reports on all non-matching expectations. This is only called when no better options are available.
 
virtual void report_inapplicable_matches (CallReport call, std::vector< ExpectationReport > expectationReports)=0
 Handles reports for all inapplicable but otherwise matching expectations. This function is called only when no better options are available.
 
virtual void report_full_match (CallReport call, ExpectationReport expectationReport) noexcept=0
 Handles the report for a fully matching expectation.
 
virtual void report_unfulfilled_expectation (ExpectationReport expectationReport)=0
 Handles the report of an unfulfilled expectation.
 
virtual void report_error (StringT message)=0
 Handles general or unspecified errors.
 
virtual void report_unhandled_exception (CallReport call, ExpectationReport expectationReport, std::exception_ptr exception)=0
 Handles reports about unhandled exceptions during handle_call.
 

Protected Member Functions

 IReporter ()=default
 
 IReporter (const IReporter &)=default
 
IReporteroperator= (const IReporter &)=default
 
 IReporter (IReporter &&)=default
 
IReporteroperator= (IReporter &&)=default
 

Detailed Description

The reporter interface.

This is the central interface to be used, when creating reporters for external domains.

Constructor & Destructor Documentation

◆ ~IReporter()

virtual mimicpp::reporting::IReporter::~IReporter ( )
virtualdefault

Defaulted virtual destructor.

◆ IReporter() [1/3]

mimicpp::reporting::IReporter::IReporter ( )
nodiscardprotecteddefault
Here is the caller graph for this function:

◆ IReporter() [2/3]

mimicpp::reporting::IReporter::IReporter ( const IReporter & )
protecteddefault
Here is the call graph for this function:

◆ IReporter() [3/3]

mimicpp::reporting::IReporter::IReporter ( IReporter && )
protecteddefault
Here is the call graph for this function:

Member Function Documentation

◆ operator=() [1/2]

IReporter & mimicpp::reporting::IReporter::operator= ( const IReporter & )
protecteddefault
Here is the call graph for this function:

◆ operator=() [2/2]

IReporter & mimicpp::reporting::IReporter::operator= ( IReporter && )
protecteddefault
Here is the call graph for this function:

◆ report_error()

virtual void mimicpp::reporting::IReporter::report_error ( StringT message)
pure virtual

Handles general or unspecified errors.

Parameters
messageThe error message.

This function is called when a non-specific error occurs.

Note
In general, this function is expected to throw an exception rather than return. However, as it may be called for various reasons, implementations should check for existing uncaught exceptions before throwing their own. This can be done using std::uncaught_exceptions().
See also
DefaultReporter::report_error for an example.

Implemented in mimicpp::reporting::BasicReporter< successReporter, warningReporter, failReporter >, mimicpp::reporting::BasicReporter< &detail::boost_test::send_success, &detail::boost_test::send_warning, &detail::boost_test::send_fail >, mimicpp::reporting::BasicReporter< &detail::boost_test::send_success, &detail::boost_test::send_warning, &detail::boost_test::send_fail >, mimicpp::reporting::BasicReporter< &detail::catch2::send_success, &detail::catch2::send_warning, &detail::catch2::send_fail >, mimicpp::reporting::BasicReporter< &detail::catch2::send_success, &detail::catch2::send_warning, &detail::catch2::send_fail >, mimicpp::reporting::BasicReporter< &detail::doctest::send_success, &detail::doctest::send_warning, &detail::doctest::send_fail >, mimicpp::reporting::BasicReporter< &detail::doctest::send_success, &detail::doctest::send_warning, &detail::doctest::send_fail >, mimicpp::reporting::BasicReporter< &detail::gtest::send_success, &detail::gtest::send_warning, &detail::gtest::send_fail >, mimicpp::reporting::BasicReporter< &detail::gtest::send_success, &detail::gtest::send_warning, &detail::gtest::send_fail >, and mimicpp::reporting::DefaultReporter.

◆ report_full_match()

virtual void mimicpp::reporting::IReporter::report_full_match ( CallReport call,
ExpectationReport expectationReport )
pure virtualnoexcept

Handles the report for a fully matching expectation.

Parameters
callThe call report.
expectationReportReport of the fully matched expectation.

This function is called when a match has been found. There are no other expectations for the behavior of this function, except for the noexcept guarantee. Implementations should simply return to the caller.

Implemented in mimicpp::reporting::BasicReporter< successReporter, warningReporter, failReporter >, mimicpp::reporting::BasicReporter< &detail::boost_test::send_success, &detail::boost_test::send_warning, &detail::boost_test::send_fail >, mimicpp::reporting::BasicReporter< &detail::boost_test::send_success, &detail::boost_test::send_warning, &detail::boost_test::send_fail >, mimicpp::reporting::BasicReporter< &detail::catch2::send_success, &detail::catch2::send_warning, &detail::catch2::send_fail >, mimicpp::reporting::BasicReporter< &detail::catch2::send_success, &detail::catch2::send_warning, &detail::catch2::send_fail >, mimicpp::reporting::BasicReporter< &detail::doctest::send_success, &detail::doctest::send_warning, &detail::doctest::send_fail >, mimicpp::reporting::BasicReporter< &detail::doctest::send_success, &detail::doctest::send_warning, &detail::doctest::send_fail >, mimicpp::reporting::BasicReporter< &detail::gtest::send_success, &detail::gtest::send_warning, &detail::gtest::send_fail >, mimicpp::reporting::BasicReporter< &detail::gtest::send_success, &detail::gtest::send_warning, &detail::gtest::send_fail >, and mimicpp::reporting::DefaultReporter.

◆ report_inapplicable_matches()

virtual void mimicpp::reporting::IReporter::report_inapplicable_matches ( CallReport call,
std::vector< ExpectationReport > expectationReports )
pure virtual

Handles reports for all inapplicable but otherwise matching expectations. This function is called only when no better options are available.

Parameters
callThe call report.
expectationReportsReports of all inapplicable expectations.

This function is called when no applicable match has been found, but the call expectations are actually fulfilled. This occurs when the "times" policy is already saturated (e.g., it was expected once and has already been matched once) or is otherwise not applicable (e.g., a sequence element is not the current element).

Attention
Derived reporter implementations must never return normally and should instead exit the function either by throwing an exception or using a terminating mechanism (e.g., std::abort). Failing to do so will result in undefined behavior.

Implemented in mimicpp::reporting::BasicReporter< successReporter, warningReporter, failReporter >, mimicpp::reporting::BasicReporter< &detail::boost_test::send_success, &detail::boost_test::send_warning, &detail::boost_test::send_fail >, mimicpp::reporting::BasicReporter< &detail::boost_test::send_success, &detail::boost_test::send_warning, &detail::boost_test::send_fail >, mimicpp::reporting::BasicReporter< &detail::catch2::send_success, &detail::catch2::send_warning, &detail::catch2::send_fail >, mimicpp::reporting::BasicReporter< &detail::catch2::send_success, &detail::catch2::send_warning, &detail::catch2::send_fail >, mimicpp::reporting::BasicReporter< &detail::doctest::send_success, &detail::doctest::send_warning, &detail::doctest::send_fail >, mimicpp::reporting::BasicReporter< &detail::doctest::send_success, &detail::doctest::send_warning, &detail::doctest::send_fail >, mimicpp::reporting::BasicReporter< &detail::gtest::send_success, &detail::gtest::send_warning, &detail::gtest::send_fail >, mimicpp::reporting::BasicReporter< &detail::gtest::send_success, &detail::gtest::send_warning, &detail::gtest::send_fail >, and mimicpp::reporting::DefaultReporter.

◆ report_no_matches()

virtual void mimicpp::reporting::IReporter::report_no_matches ( CallReport call,
std::vector< NoMatchReport > noMatchReports )
pure virtual

Expects reports on all non-matching expectations. This is only called when no better options are available.

Parameters
callThe call report.
noMatchReportsReports of all none matching expectations.

This function is called when no match has been found and there are no other expectations that are matching but inapplicable. It serves as the fallback reporting mechanism for unmatched calls.

Note
noMatchReports may be empty.
Attention
Derived reporter implementations must never return normally and should instead exit the function either by throwing an exception or using a terminating mechanism (e.g., std::abort). Failing to do so will result in undefined behavior.

Implemented in mimicpp::reporting::BasicReporter< successReporter, warningReporter, failReporter >, mimicpp::reporting::BasicReporter< &detail::boost_test::send_success, &detail::boost_test::send_warning, &detail::boost_test::send_fail >, mimicpp::reporting::BasicReporter< &detail::boost_test::send_success, &detail::boost_test::send_warning, &detail::boost_test::send_fail >, mimicpp::reporting::BasicReporter< &detail::catch2::send_success, &detail::catch2::send_warning, &detail::catch2::send_fail >, mimicpp::reporting::BasicReporter< &detail::catch2::send_success, &detail::catch2::send_warning, &detail::catch2::send_fail >, mimicpp::reporting::BasicReporter< &detail::doctest::send_success, &detail::doctest::send_warning, &detail::doctest::send_fail >, mimicpp::reporting::BasicReporter< &detail::doctest::send_success, &detail::doctest::send_warning, &detail::doctest::send_fail >, mimicpp::reporting::BasicReporter< &detail::gtest::send_success, &detail::gtest::send_warning, &detail::gtest::send_fail >, mimicpp::reporting::BasicReporter< &detail::gtest::send_success, &detail::gtest::send_warning, &detail::gtest::send_fail >, and mimicpp::reporting::DefaultReporter.

◆ report_unfulfilled_expectation()

virtual void mimicpp::reporting::IReporter::report_unfulfilled_expectation ( ExpectationReport expectationReport)
pure virtual

Handles the report of an unfulfilled expectation.

Parameters
expectationReportThe expectation report.

This function is called when an unfulfilled expectation goes out of scope. This occurs when the "times" policy is not satisfied.

Note
In general, this function is expected to not return but throw an exception instead. However, since it is always called when an unfulfilled expectation goes out of scope, implementations shall check whether an uncaught exception already exists (e.g., via std::uncaught_exceptions) before throwing their own exception.
See also
DefaultReporter::report_unfulfilled_expectation for an example.

Implemented in mimicpp::reporting::BasicReporter< successReporter, warningReporter, failReporter >, mimicpp::reporting::BasicReporter< &detail::boost_test::send_success, &detail::boost_test::send_warning, &detail::boost_test::send_fail >, mimicpp::reporting::BasicReporter< &detail::boost_test::send_success, &detail::boost_test::send_warning, &detail::boost_test::send_fail >, mimicpp::reporting::BasicReporter< &detail::catch2::send_success, &detail::catch2::send_warning, &detail::catch2::send_fail >, mimicpp::reporting::BasicReporter< &detail::catch2::send_success, &detail::catch2::send_warning, &detail::catch2::send_fail >, mimicpp::reporting::BasicReporter< &detail::doctest::send_success, &detail::doctest::send_warning, &detail::doctest::send_fail >, mimicpp::reporting::BasicReporter< &detail::doctest::send_success, &detail::doctest::send_warning, &detail::doctest::send_fail >, mimicpp::reporting::BasicReporter< &detail::gtest::send_success, &detail::gtest::send_warning, &detail::gtest::send_fail >, mimicpp::reporting::BasicReporter< &detail::gtest::send_success, &detail::gtest::send_warning, &detail::gtest::send_fail >, and mimicpp::reporting::DefaultReporter.

◆ report_unhandled_exception()

virtual void mimicpp::reporting::IReporter::report_unhandled_exception ( CallReport call,
ExpectationReport expectationReport,
std::exception_ptr exception )
pure virtual

Handles reports about unhandled exceptions during handle_call.

Parameters
callThe call report.
expectationReportThe expectation report.
exceptionThe exception.

This function is called when an expectation throws an exception during a matches call. There are no specific requirements for the behavior of this function. Since this function is called inside a catch-block, throwing exceptions will result in a terminate call.

Implemented in mimicpp::reporting::BasicReporter< successReporter, warningReporter, failReporter >, mimicpp::reporting::BasicReporter< &detail::boost_test::send_success, &detail::boost_test::send_warning, &detail::boost_test::send_fail >, mimicpp::reporting::BasicReporter< &detail::boost_test::send_success, &detail::boost_test::send_warning, &detail::boost_test::send_fail >, mimicpp::reporting::BasicReporter< &detail::catch2::send_success, &detail::catch2::send_warning, &detail::catch2::send_fail >, mimicpp::reporting::BasicReporter< &detail::catch2::send_success, &detail::catch2::send_warning, &detail::catch2::send_fail >, mimicpp::reporting::BasicReporter< &detail::doctest::send_success, &detail::doctest::send_warning, &detail::doctest::send_fail >, mimicpp::reporting::BasicReporter< &detail::doctest::send_success, &detail::doctest::send_warning, &detail::doctest::send_fail >, mimicpp::reporting::BasicReporter< &detail::gtest::send_success, &detail::gtest::send_warning, &detail::gtest::send_fail >, mimicpp::reporting::BasicReporter< &detail::gtest::send_success, &detail::gtest::send_warning, &detail::gtest::send_fail >, and mimicpp::reporting::DefaultReporter.


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