micro-test-plus 4.1.0
µTest++ Testing Framework
Loading...
Searching...
No Matches
reporter-human.h
Go to the documentation of this file.
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.0 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 "reporter.h"
56#include "reflection.h"
57
58// ----------------------------------------------------------------------------
59
60#if defined(__GNUC__)
61#pragma GCC diagnostic push
62#pragma GCC diagnostic ignored "-Wpadded"
63#if defined(__clang__)
64#pragma clang diagnostic ignored "-Wc++98-compat"
65#endif
66#endif
67
68// ============================================================================
69
71{
72 // --------------------------------------------------------------------------
73
74 class runner;
75 class suite;
76 class subtest;
77
78 // ==========================================================================
79
101 class reporter_human final : public reporter
102 {
103 public:
110 reporter_human (std::unique_ptr<std::vector<std::string_view>> argvs);
111
116
121
127 = delete;
128
134 = delete;
135
139 ~reporter_human () override;
140
141 // ------------------------------------------------------------------------
142
151
152 // Bring base class operator<< overloads into scope to prevent name hiding.
153 using reporter::operator<<;
154
155 // ------------------------------------------------------------------------
156
164 void
165 begin_session (runner& runner) override;
166
174 void
175 end_session (runner& runner) override;
176
184 virtual void
185 begin_suite (suite& suite) override;
186
194 virtual void
195 end_suite (suite& suite) override;
196
204 virtual void
205 begin_subtest (subtest& subtest) override;
206
214 virtual void
215 end_subtest (subtest& subtest) override;
216
225 virtual const char*
226 get_comment_prefix (void) override;
227
228 protected:
237 void
238 output_pass_prefix_ (std::string& message, subtest& subtest) override;
239
247 void
249
261 void
262 output_fail_prefix_ (std::string& message, const bool has_expression,
263 const reflection::source_location& location,
264 subtest& subtest) override;
265
275 void
277 bool abort, subtest& subtest) override;
278 };
279
280 // --------------------------------------------------------------------------
281} // namespace micro_os_plus::micro_test_plus
282
283#if defined(__GNUC__)
284#pragma GCC diagnostic pop
285#endif
286
287// ----------------------------------------------------------------------------
288
289#endif // __cplusplus
290
291// ----------------------------------------------------------------------------
292
293#endif // MICRO_TEST_PLUS_TEST_REPORTER_BASIC_H_
294
295// ----------------------------------------------------------------------------
Local implementation of source location information for diagnostics.
Definition reflection.h:138
virtual void end_subtest(subtest &subtest) override
Mark the end of a subtest.
virtual void begin_suite(suite &suite) override
Mark the beginning of a suite.
void output_fail_prefix_(std::string &message, const bool has_expression, const reflection::source_location &location, subtest &subtest) override
Outputs the prefix for a failing condition.
void end_session(runner &runner) override
Mark the end of a test session.
reporter_human(std::unique_ptr< std::vector< std::string_view > > argvs)
Constructor for the reporter_human class.
reporter_human & operator=(const reporter_human &)=delete
Deleted copy assignment operator to prevent copying.
virtual void begin_subtest(subtest &subtest) override
Mark the beginning of a subtest.
reporter_human & operator<<(detail::indent_t m)
Output operator for the indent_t manipulator.
reporter_human(const reporter_human &)=delete
Deleted copy constructor to prevent copying.
void begin_session(runner &runner) override
Mark the beginning of a test session.
virtual void end_suite(suite &suite) override
Mark the end of a test suite.
void output_pass_suffix_(subtest &subtest) override
Outputs the suffix for a passing condition.
virtual const char * get_comment_prefix(void) override
Returns an empty comment prefix string.
void output_pass_prefix_(std::string &message, subtest &subtest) override
Outputs the prefix for a passing condition.
reporter_human(reporter_human &&)=delete
Deleted move constructor to prevent moving.
void output_fail_suffix_(const reflection::source_location &location, bool abort, subtest &subtest) override
Outputs the suffix for a failing condition.
~reporter_human() override
Destructor for the reporter_human class.
reporter(std::unique_ptr< std::vector< std::string_view > > argvs)
Constructor for the reporter class.
Definition reporter.cpp:79
The test runner for the µTest++ framework.
Definition runner.h:111
A named, runnable test case that lives inside a suite.
Definition test.h:542
A named, runnable test suite registered with the test runner.
Definition test.h:714
Primary namespace for the µTest++ testing framework.
C++ header file with declarations for the µTest++ reflection utilities.
C++ header file with declarations for the µTest++ test reporter.
Parameterised stream manipulator for outputting indentation.
Definition reporter.h:138