6#ifndef MIMICPP_REPORTING_DEFAULT_REPORTER_HPP
7#define MIMICPP_REPORTING_DEFAULT_REPORTER_HPP
20#ifndef MIMICPP_DETAIL_IS_MODULE
30 template <
typename Data = std::
nullptr_t>
32 :
public std::logic_error
37 std::string
const& what,
40 : std::logic_error{what},
41 m_Data{std::move(
data)},
47 Data
const&
data() const noexcept
78 : m_Out{std::addressof(out)}
85 std::vector<NoMatchReport> noMatchReports)
override
90 *m_Out << msg <<
'\n';
99 std::vector<ExpectationReport> expectationReports)
override
105 *m_Out << msg <<
'\n';
115 MIMICPP_ASSERT(std::holds_alternative<state_applicable>(expectationReport.controlReport),
"Report denotes inapplicable expectation.");
120 if (0 == std::uncaught_exceptions())
125 *m_Out << msg <<
'\n';
134 if (0 == std::uncaught_exceptions())
138 *m_Out << message <<
'\n';
141 throw Error{message};
148 const std::exception_ptr exception)
override
158 std::ostream* m_Out{};
#define MIMICPP_ASSERT(condition, msg)
Definition Config.hpp:51
#define MIMICPP_DETAIL_MODULE_EXPORT
Definition Config.hpp:19
Contains the extracted info from a typed call::Info.
Definition CallReport.hpp:43
void report_unhandled_exception(const CallReport call, const ExpectationReport expectationReport, const std::exception_ptr exception) override
Handles reports about unhandled exceptions during handle_call.
Definition DefaultReporter.hpp:145
void report_no_matches(CallReport call, std::vector< NoMatchReport > noMatchReports) override
Expects reports on all non-matching expectations. This is only called when no better options are avai...
Definition DefaultReporter.hpp:83
DefaultReporter(std::ostream &out) noexcept
Definition DefaultReporter.hpp:77
DefaultReporter()=default
void report_inapplicable_matches(CallReport call, std::vector< ExpectationReport > expectationReports) override
Handles reports for all inapplicable but otherwise matching expectations. This function is called onl...
Definition DefaultReporter.hpp:97
void report_full_match(CallReport const call, ExpectationReport const expectationReport) noexcept override
Handles the report for a fully matching expectation.
Definition DefaultReporter.hpp:111
void report_unfulfilled_expectation(ExpectationReport expectationReport) override
Handles the report of an unfulfilled expectation.
Definition DefaultReporter.hpp:118
void report_error(const StringT message) override
Handles general or unspecified errors.
Definition DefaultReporter.hpp:132
Definition DefaultReporter.hpp:33
Error(std::string const &what, Data &&data={}, util::SourceLocation loc={})
Definition DefaultReporter.hpp:36
CallReport const & data() const noexcept
Definition DefaultReporter.hpp:47
util::SourceLocation const & where() const noexcept
Definition DefaultReporter.hpp:53
Contains the extracted info from a typed expectation.
Definition ExpectationReport.hpp:85
A thin wrapper around general source-location info.
Definition SourceLocation.hpp:38
Definition BasicReporter.hpp:27
StringT stringify_unhandled_exception(CallReport const &call, ExpectationReport const &expectationReport, std::exception_ptr const &exception)
Definition StringifyReports.hpp:466
Error< ExpectationReport > UnfulfilledExpectationT
Definition DefaultReporter.hpp:64
StringT stringify_unfulfilled_expectation(ExpectationReport const &expectationReport)
Definition StringifyReports.hpp:450
StringT stringify_inapplicable_matches(CallReport const &call, std::span< ExpectationReport > expectations)
Definition StringifyReports.hpp:349
Error< CallReport > UnmatchedCallT
Definition DefaultReporter.hpp:63
StringT stringify_no_matches(CallReport const &call, std::span< NoMatchReport > noMatchReports)
Definition StringifyReports.hpp:388
std::basic_string< CharT, CharTraitsT > StringT
Definition Fwd.hpp:391