Skip to main content

reporter-human.h File

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

Included Headers

#include "reporter.h" #include "reflection.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

classreporter_human

Human (standard output) implementation of reporter. More...

Description

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

This header provides the declaration for reporter_human, the default concrete implementation of the 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 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_OS_PLUS_MICRO_TEST_PLUS_TEST_REPORTER_BASIC_H_
47#define MICRO_OS_PLUS_MICRO_TEST_PLUS_TEST_REPORTER_BASIC_H_
48
49// ----------------------------------------------------------------------------
50
51#if defined(__cplusplus)
52
53// ----------------------------------------------------------------------------
54
55#if __has_include("micro-os-plus/project-config.h")
56#include "micro-os-plus/project-config.h"
57#endif // __has_include("micro-os-plus/project-config.h")
58
59#if __has_include("micro-os-plus/micro-test-plus-defines.h")
60#include "micro-os-plus/micro-test-plus-defines.h"
61#endif // __has_include("micro-os-plus/micro-test-plus-defines.h")
62
63#include "reporter.h"
64#include "reflection.h"
65
66// ----------------------------------------------------------------------------
67
68#if defined(__GNUC__)
69#pragma GCC diagnostic push
70
71#pragma GCC diagnostic ignored "-Wpadded"
72#if defined(__clang__)
73#pragma clang diagnostic ignored "-Wc++98-compat"
74#endif // defined(__clang__)
75#endif // defined(__GNUC__)
76
77// ============================================================================
78
80{
81 // --------------------------------------------------------------------------
82
83 class runner;
84 class suite;
85 class subtest;
86
87 // ==========================================================================
88
110 class reporter_human final : public reporter
111 {
112 public:
119 reporter_human (std::unique_ptr<std::vector<std::string_view>> argvs);
120
124 reporter_human (const reporter_human&) = delete;
125
130
136 = delete;
137
143 = delete;
144
148 ~reporter_human () override;
149
150 // ------------------------------------------------------------------------
151
160
161 // Bring base class operator<< overloads into scope to prevent name hiding.
162 using reporter::operator<<;
163
164 // ------------------------------------------------------------------------
165
173 void
174 begin_session (runner& runner) override;
175
183 void
184 end_session (runner& runner) override;
185
193 virtual void
194 begin_suite (suite& suite) override;
195
203 virtual void
204 end_suite (suite& suite) override;
205
213 virtual void
214 begin_subtest (subtest& subtest) override;
215
223 virtual void
224 end_subtest (subtest& subtest) override;
225
234 virtual const char*
235 get_comment_prefix (void) override;
236
237 protected:
246 void
247 output_pass_prefix_ (std::string& message, subtest& subtest) override;
248
256 void
258
270 void
271 output_fail_prefix_ (std::string& message, const bool has_expression,
272 const reflection::source_location& location,
273 subtest& subtest) override;
274
284 void
286 bool abort, subtest& subtest) override;
287 };
288
289 // --------------------------------------------------------------------------
290} // namespace micro_os_plus::micro_test_plus
291
292#if defined(__GNUC__)
293#pragma GCC diagnostic pop
294#endif // defined(__GNUC__)
295
296// ----------------------------------------------------------------------------
297
298#endif // defined(__cplusplus)
299
300// ----------------------------------------------------------------------------
301
302#endif // MICRO_OS_PLUS_MICRO_TEST_PLUS_TEST_REPORTER_BASIC_H_
303
304// ----------------------------------------------------------------------------

Generated via doxygen2docusaurus 2.2.2 by Doxygen 1.17.0.