Skip to main content

The details-inlines.h File Reference

C++ header file with inline implementations for the µTest++ internals. More...

Included Headers

#include <stdio.h>
#include <cstring>

Namespaces Index

namespacemicro_os_plus

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

namespacemicro_os_plus::micro_test_plus

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

namespacemicro_os_plus::micro_test_plus::detail

Internal implementation details for the µTest++ framework. More...

Description

C++ header file with inline implementations for the µTest++ internals.

This header provides the inline implementations for internal components of the µTest++ framework, including operator overloads and constructors for deferred reporting mechanisms.

It defines the logic for accumulating expectation messages, handling both arithmetic and string-like types, as well as the construction and destruction behaviour of deferred reporters, ensuring that test outcomes are accurately captured and reported.

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 * This file is part of the µOS++ project (https://micro-os-plus.github.io/).
3 * Copyright (c) 2021 Liviu Ionescu. All rights reserved.
4 *
5 * Permission to use, copy, modify, and/or distribute this software
6 * for any 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
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&#95;1&#95;0.txt.
14 */
15
16// ----------------------------------------------------------------------------
17
44
45#ifndef MICRO_TEST_PLUS_DETAILS_INLINES_H_
46#define MICRO_TEST_PLUS_DETAILS_INLINES_H_
47
48// ----------------------------------------------------------------------------
49
50#ifdef __cplusplus
51
52// ----------------------------------------------------------------------------
53
54#include <stdio.h>
55#include <cstring>
56// #include "test-reporter.h"
57
58// ----------------------------------------------------------------------------
59
60#if defined(__GNUC__)
61#pragma GCC diagnostic push
62#pragma GCC diagnostic ignored "-Waggregate-return"
63#if defined(__clang__)
64#pragma clang diagnostic ignored "-Wc++98-compat"
65#pragma clang diagnostic ignored "-Wc++98-compat-pedantic"
66#endif
67#endif
68
70{
71 // --------------------------------------------------------------------------
72
73 namespace detail
74 {
75 // ------------------------------------------------------------------------
76
88 template <class T>
89 auto&
91 {
92 if constexpr (std::is_arithmetic_v<T>)
93 {
94 message_.append (std::to_string (msg));
95 }
96 else
97 {
98 message_.append (msg);
99 }
100 return *this;
101 }
102
103 // ------------------------------------------------------------------------
104
116 template <class Expr_T>
118 const Expr_T& expr, bool abort,
119 const reflection::source_location& location)
120 : deferred_reporter_base{ static_cast<bool> (expr), location },
121 expr_{ expr }
122 {
123#if 0 // defined(MICRO_OS_PLUS_TRACE_MICRO_TEST_PLUS)
124 printf ("%s\n", __PRETTY_FUNCTION__);
125#endif // MICRO_OS_PLUS_TRACE_MICRO_TEST_PLUS
126 abort_ = abort;
127 }
128
141 template <class Expr_T>
143 {
144 if (value_)
145 {
146 reporter.pass (expr_, message_);
147 }
148 else
149 {
151 }
152 }
153
154 // ------------------------------------------------------------------------
155 } // namespace detail
156
157 // --------------------------------------------------------------------------
158} // namespace micro_os_plus::micro_test_plus
159
160#if defined(__GNUC__)
161#pragma GCC diagnostic pop
162#endif
163
164// ----------------------------------------------------------------------------
165
166#endif // __cplusplus
167
168// ----------------------------------------------------------------------------
169
170#endif // MICRO_TEST_PLUS_DETAILS_INLINES_H_
171
172// ----------------------------------------------------------------------------

Generated via docusaurus-plugin-doxygen by Doxygen 1.14.0.