Skip to main content

test-reporter-basic.h File

C++ header file with declarations for the µTest++ basic test reporter. More...

Included Headers

#include "test-reporter.h"

Namespaces Index

namespacemicro_os_plus

The primary namespace for the µOS++ framework. More...

namespacemicro_test_plus

Primary namespace for the µTest++ testing framework. More...

Classes Index

classtest_reporter_basic

Basic (standard output) implementation of test_reporter. More...

Description

C++ header file with declarations for the µTest++ basic test reporter.

This header provides the declaration for test_reporter_basic, the default concrete implementation of the test_reporter abstract interface. It formats and presents test results using printf-based standard output, accumulating output in an internal string buffer and supporting colour-coded diagnostics and multiple verbosity levels.

Users who require custom output behaviour (e.g. redirecting to a serial port on bare-metal targets) may derive a new class from test_reporter instead of using this class.

All definitions reside within the micro_os_plus::micro_test_plus namespace, ensuring clear separation from user code and minimising the risk of naming conflicts.

The header files are organised within the include/micro-os-plus/micro-test-plus folder to maintain a structured and modular codebase.

This file is intended solely for internal use within the framework and should not be included directly by user code.

File Listing

The file content with the documentation metadata removed is:

1/*
2 * This file is part of the µOS++ project (https://micro-os-plus.github.io/).
3 * Copyright (c) 2021-2026 Liviu Ionescu. All rights reserved.
4 *
5 * Permission to use, copy, modify, and/or distribute this software for any
6 * purpose is hereby granted, under the terms of the MIT license.
7 *
8 * If a copy of the license was not distributed with this file, it can be
9 * obtained from https://opensource.org/licenses/mit.
10 *
11 * Major parts of the code are inspired from v1.1.8 of the Boost UT project,
12 * released under the terms of the Boost Version 1 Software License,
13 * which can be obtained from https://www.boost.org/LICENSE_1_0.txt.
14 */
15
16// ----------------------------------------------------------------------------
17
45
46#ifndef MICRO_TEST_PLUS_TEST_REPORTER_BASIC_H_
47#define MICRO_TEST_PLUS_TEST_REPORTER_BASIC_H_
48
49// ----------------------------------------------------------------------------
50
51#ifdef __cplusplus
52
53// ----------------------------------------------------------------------------
54
55#include "test-reporter.h"
56
57// ----------------------------------------------------------------------------
58
59#if defined(__GNUC__)
60#pragma GCC diagnostic push
61#pragma GCC diagnostic ignored "-Wpadded"
62#if defined(__clang__)
63#pragma clang diagnostic ignored "-Wc++98-compat"
64#endif
65#endif
66
68{
69 // --------------------------------------------------------------------------
70
92 class test_reporter_basic final : public test_reporter
93 {
94 public:
102
107
112
118 = delete;
119
125 = delete;
126
130 ~test_reporter_basic () override = default;
131
140 void
141 endline (void) override;
142
150 void
151 begin_test_case (const char* name) override;
152
160 void
161 end_test_case (const char* name) override;
162
170 void
171 begin_test_suite (const char* name) override;
172
180 void
181 end_test_suite (test_suite_base& suite) override;
182
190 void
191 begin_test (size_t test_suites_count) override;
192
200 void
201 end_test (test_runner& runner) override;
202
211 void
212 flush (void) override;
213
222 void
223 output (void) override;
224
225 protected:
233 void
234 output_pass_prefix_ (std::string& message) override;
235
244 void
245 output_pass_suffix_ (void) override;
246
257 void
258 output_fail_prefix_ (std::string& message, const bool hasExpression,
259 const reflection::source_location& location) override;
260
269 void
271 bool abort) override;
272 };
273
274 // --------------------------------------------------------------------------
275} // namespace micro_os_plus::micro_test_plus
276
277#if defined(__GNUC__)
278#pragma GCC diagnostic pop
279#endif
280
281// ----------------------------------------------------------------------------
282
283#endif // __cplusplus
284
285// ----------------------------------------------------------------------------
286
287#endif // MICRO_TEST_PLUS_TEST_REPORTER_BASIC_H_
288
289// ----------------------------------------------------------------------------

Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.14.0.