46#if defined(MICRO_OS_PLUS_INCLUDE_CONFIG_H)
47#include <micro-os-plus/config.h>
54#pragma GCC diagnostic ignored "-Waggregate-return"
56#pragma clang diagnostic ignored "-Wc++98-compat"
57#pragma clang diagnostic ignored "-Wc++98-compat-pedantic"
103 if (!message.empty ())
105 *
this << message.c_str ();
154 if (!message.empty ())
156 *
this << message.c_str ();
160#pragma GCC diagnostic push
161#if defined(__clang__)
162#pragma clang diagnostic ignored "-Wsign-conversion"
163#elif defined(__GNUC__)
164#pragma GCC diagnostic ignored "-Wnarrowing"
165#pragma GCC diagnostic ignored "-Wsign-conversion"
171#pragma GCC diagnostic pop
189 *
this <<
" aborted...";
311 out_.append (v ?
"true" :
"false");
325 out_.append (
"nullptr");
340 out_.append (std::to_string (c));
356 out_.append (std::to_string (
static_cast<int> (c)));
372 out_.append (std::to_string (v));
388 out_.append (std::to_string (
static_cast<long> (v)));
404 out_.append (std::to_string (v));
419 out_.append (std::to_string (v));
435 out_.append (std::to_string (v));
451 out_.append (std::to_string (v));
467 out_.append (std::to_string (v));
483 out_.append (std::to_string (v));
499 out_.append (std::to_string (v));
515 out_.append (std::to_string (v));
531 out_.append (std::to_string (v));
590 printf (
" • %s - test case started\n", name);
593 " %s✗%s %s - test case %sFAILED%s (%d %s passed, %d "
611 printf (
" • %s - test case started\n", name);
614 " %s✓%s %s - test case passed (%d %s)\n",
colors_.pass,
627 " %s✓%s %s - test case passed (%d %s)\n",
colors_.pass,
671 printf (
"• %s - test suite started\n", name);
705 printf (
"%s✓%s %s - test suite passed (%d %s in %d test %s)\n",
714 printf (
"%s✗%s %s - test suite %sFAILED%s (%d %s passed, %d failed, "
737 printf (
"%s",
out_.c_str ());
Local implementation of source location information for diagnostics.
constexpr auto file_name(void) const noexcept
Retrieve the file name associated with this source location.
constexpr auto line(void) const noexcept
Retrieve the line number associated with this source location.
Reporter to display test results, including operand values and types for failures.
colors colors_
ANSI colour codes for output formatting.
void endline(void)
Inserts a line ending into the output buffer.
bool is_in_test_case_
Indicates whether the reporter is currently within a test case.
std::string out_
Internal output buffer for accumulating report content.
test_reporter()=default
Default constructor for the test_reporter class.
void output_pass_suffix_(void)
Outputs the suffix for a passing condition.
void output(void)
Output the current buffered content.
void output_fail_suffix_(bool abort)
Outputs the suffix for a failing condition.
void flush(void)
Flush the current buffered content.
void end_test_case(const char *name)
Mark the end of a test case.
void begin_test_case(const char *name)
Mark the beginning of a test case.
test_reporter & operator<<(std::string_view sv)
Output operator for std::string_view.
void end_test_suite(test_suite_base &suite)
Mark the end of a test suite.
void begin_test_suite(const char *name)
Mark the beginning of a test suite.
verbosity_t verbosity
The verbosity level for test reporting.
void output_fail_prefix_(std::string &message, const reflection::source_location &location)
Outputs the prefix for a failing condition.
bool add_empty_line
Controls whether to add an empty line between successful test cases.
void output_pass_prefix_(std::string &message)
Outputs the prefix for a passing condition.
Base class for all test suites.
constexpr const char * name(void)
Gets the suite name.
int failed_checks
Number of failed checks in the current test case.
int successful_checks
Number of successful checks in the current test case.
constexpr int test_cases(void)
Gets the number of test cases.
Main C++ header with the declarations for the µTest++ Testing Framework.
const char * short_name(const char *name)
Extract a short type or function name from a fully qualified name.
Primary namespace for the µTest++ testing framework.
test_suite_base * current_test_suite
Global pointer references the currently active test suite.
test_reporter & endl(test_reporter &stream)
Output stream manipulator for ending a line in test reports.
test_reporter reporter
Global instance of test_reporter.
Struct template representing a genuine integral value.