C++ header file with inline implementations for the µTest++ test reporter. More...
#include <stdio.h>
#include <cstring>
Namespaces Index
Description
C++ header file with inline implementations for the µTest++ test reporter.
This header provides the inline implementations for the test reporting facilities used within the µTest++ framework. It defines the logic for formatting and outputting test results, including operator overloads for various value types, containers, and comparison expressions, as well as structured output for logical and exception-related assertions.
The implementations ensure that test outcomes are presented in a clear, consistent, and expressive manner, supporting both value and pointer semantics, and providing detailed diagnostics for both successful and failed test cases. Special attention is given to formatting, colour highlighting, and extensibility, enabling professional and readable test reports suitable for embedded and general C++ development.
All definitions reside within the micro_os_plus::micro_test_plus::detail
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
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
48
49#ifndef MICRO_TEST_PLUS_TEST_REPORTER_INLINES_H_
50#define MICRO_TEST_PLUS_TEST_REPORTER_INLINES_H_
51
52
53
54#ifdef __cplusplus
55
56
57
58#include <stdio.h>
59#include <cstring>
60
61
62
63#if defined(__GNUC__)
64#pragma GCC diagnostic push
65#pragma GCC diagnostic ignored "-Waggregate-return"
66#if defined(__clang__)
67#pragma clang diagnostic ignored "-Wc++98-compat"
68#pragma clang diagnostic ignored "-Wc++98-compat-pedantic"
69#endif
70#endif
71
73{
74
75
90 template <typename T>
93 {
94 char buff[20];
95 snprintf (buff, sizeof (buff), "%p", reinterpret_cast<void*> (v));
97
98 return *this;
99 }
100
101#if 0
110 template <class T>
113 {
115 return *this;
116 }
117#endif
118
133 template <class T>
136 {
137 out_.append (std::to_string (static_cast<long long> (v.get ()))); 138 return *this;
139 }
140
155 template <class T,
160 {
161 *this << '{';
162 auto first = true;
163 for (const auto& arg : t)
164 {
165 *this << (first ? "" : ", ") << arg;
166 first = false;
167 }
168 *this << '}';
169 return *this;
170 }
171
183 template <class Lhs_T, class Rhs_T>
186 {
187 return (*this << color (op) << op.lhs () << " == " << op.rhs () 189 }
190
203 template <class Lhs_T, class Rhs_T>
206 {
207 return (*this << color (op) << op.lhs () << " != " << op.rhs () 209 }
210
223 template <class Lhs_T, class Rhs_T>
226 {
227 return (*this << color (op) << op.lhs () << " > " << op.rhs () 229 }
230
244 template <class Lhs_T, class Rhs_T>
247 {
248 return (*this << color (op) << op.lhs () << " >= " << op.rhs () 250 }
251
263 template <class Lhs_T, class Rhs_T>
266 {
267 return (*this << color (op) << op.lhs () << " < " << op.rhs () 269 }
270
284 template <class Lhs_T, class Rhs_T>
287 {
288 return (*this << color (op) << op.lhs () << " <= " << op.rhs () 290 }
291
304 template <class Lhs_T, class Rhs_T>
307 {
308 return (*this << '(' << op.lhs () << color (op) << " and " << colors_.none 309 << op.rhs () << ')'); 310 }
311
324 template <class Lhs_T, class Rhs_T>
327 {
328 return (*this << '(' << op.lhs () << color (op) << " or " << colors_.none 329 << op.rhs () << ')'); 330 }
331
340 template <class T>
343 {
345 }
346
347#if defined(__cpp_exceptions)
360 template <class Expr_T, class Exception_T>
363 {
364 return (*this << color (op) << "throws<" 367 }
368
379 template <class Expr_T>
382 {
383 return (*this << color (op) << "throws" << colors_.none); 384 }
385
396 template <class Expr_T>
399 {
400 return (*this << color (op) << "nothrow" << colors_.none); 401 }
402#endif
403
417 template <class Expr_T>
418 void
420 {
422
423 if (message.empty ())
424 {
425
426 *this << expr;
427 }
428
430 }
431
441 template <class Expr_T>
442 void
445 {
447
449 {
450 *this << ", " << expr;
451 }
452
454 }
455
456
457}
458
459#if defined(__GNUC__)
460#pragma GCC diagnostic pop
461#endif
462
463
464
465#endif
466
467
468
469#endif
470
471
Generated via docusaurus-plugin-doxygen by Doxygen 1.14.0.