@micro-os-plus/micro-test-plus 3.2.2 → 3.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.cmake-format.yaml +11 -0
- package/CHANGELOG.md +352 -2
- package/CMakeLists.txt +32 -30
- package/LICENSE +1 -1
- package/README.md +1 -1
- package/{xcdl.json → config/xcdl-build.json} +6 -6
- package/include/micro-os-plus/micro-test-plus/detail.h +1885 -0
- package/include/micro-os-plus/micro-test-plus/function-comparators.h +333 -0
- package/include/micro-os-plus/micro-test-plus/inlines/details-inlines.h +172 -0
- package/include/micro-os-plus/micro-test-plus/inlines/function-comparators-inlines.h +341 -0
- package/include/micro-os-plus/micro-test-plus/inlines/literals-inlines.h +604 -0
- package/include/micro-os-plus/micro-test-plus/inlines/math-inlines.h +315 -0
- package/include/micro-os-plus/micro-test-plus/inlines/micro-test-plus-inlines.h +313 -0
- package/include/micro-os-plus/micro-test-plus/inlines/reflection-inlines.h +170 -0
- package/include/micro-os-plus/micro-test-plus/inlines/test-reporter-inlines.h +471 -0
- package/include/micro-os-plus/micro-test-plus/inlines/test-suite-inlines.h +115 -0
- package/include/micro-os-plus/micro-test-plus/literals.h +912 -0
- package/include/micro-os-plus/micro-test-plus/math.h +217 -0
- package/include/micro-os-plus/micro-test-plus/operators.h +514 -0
- package/include/micro-os-plus/micro-test-plus/reflection.h +233 -0
- package/include/micro-os-plus/micro-test-plus/test-reporter.h +801 -0
- package/include/micro-os-plus/micro-test-plus/test-runner.h +241 -0
- package/include/micro-os-plus/micro-test-plus/test-suite.h +456 -0
- package/include/micro-os-plus/micro-test-plus/type-traits.h +1148 -0
- package/include/micro-os-plus/micro-test-plus.h +169 -551
- package/meson.build +5 -5
- package/package.json +29 -34
- package/src/micro-test-plus.cpp +131 -35
- package/src/test-reporter.cpp +348 -6
- package/src/test-runner.cpp +69 -5
- package/src/test-suite.cpp +124 -5
- package/include/micro-os-plus/detail.h +0 -765
- package/include/micro-os-plus/inlines.h +0 -209
- package/include/micro-os-plus/literals.h +0 -512
- package/include/micro-os-plus/math.h +0 -204
- package/include/micro-os-plus/reflection.h +0 -139
- package/include/micro-os-plus/test-reporter-inlines.h +0 -230
- package/include/micro-os-plus/test-reporter.h +0 -356
- package/include/micro-os-plus/test-runner.h +0 -132
- package/include/micro-os-plus/test-suite.h +0 -306
- package/include/micro-os-plus/type-traits.h +0 -389
|
@@ -1,204 +0,0 @@
|
|
|
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
|
|
9
|
-
* be 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
|
-
#ifndef MICRO_TEST_PLUS_MATH_H_
|
|
17
|
-
#define MICRO_TEST_PLUS_MATH_H_
|
|
18
|
-
|
|
19
|
-
// ----------------------------------------------------------------------------
|
|
20
|
-
|
|
21
|
-
#ifdef __cplusplus
|
|
22
|
-
|
|
23
|
-
// ----------------------------------------------------------------------------
|
|
24
|
-
|
|
25
|
-
#include <array>
|
|
26
|
-
|
|
27
|
-
// ----------------------------------------------------------------------------
|
|
28
|
-
|
|
29
|
-
#if defined(__GNUC__)
|
|
30
|
-
#pragma GCC diagnostic push
|
|
31
|
-
#pragma GCC diagnostic ignored "-Wconversion"
|
|
32
|
-
#if defined(__clang__)
|
|
33
|
-
#pragma clang diagnostic ignored "-Wc++98-compat"
|
|
34
|
-
#endif
|
|
35
|
-
#endif
|
|
36
|
-
|
|
37
|
-
namespace micro_os_plus::micro_test_plus
|
|
38
|
-
{
|
|
39
|
-
// --------------------------------------------------------------------------
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* @brief Local mathematical functions.
|
|
43
|
-
*
|
|
44
|
-
* Some may have equivalents in the standard library, but may be
|
|
45
|
-
* more complicated to use, or have only floating point variants, or
|
|
46
|
-
* not be constexpr.
|
|
47
|
-
*/
|
|
48
|
-
namespace math
|
|
49
|
-
{
|
|
50
|
-
/**
|
|
51
|
-
* @brief Generic absolute of any value.
|
|
52
|
-
*/
|
|
53
|
-
template <class T>
|
|
54
|
-
[[nodiscard]] constexpr auto
|
|
55
|
-
abs (const T t) -> T
|
|
56
|
-
{
|
|
57
|
-
return t < T{} ? -t : t;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
/**
|
|
61
|
-
* @brief Generic minimum of two values.
|
|
62
|
-
*/
|
|
63
|
-
template <class T>
|
|
64
|
-
[[nodiscard]] constexpr auto
|
|
65
|
-
min_value (const T& lhs, const T& rhs) -> const T&
|
|
66
|
-
{
|
|
67
|
-
return (rhs < lhs) ? rhs : lhs;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
/**
|
|
71
|
-
* @brief Generic 'power of', to raise base to exponent (base ^ exp).
|
|
72
|
-
*/
|
|
73
|
-
template <class T, class Exp_T>
|
|
74
|
-
[[nodiscard]] constexpr auto
|
|
75
|
-
pow (const T base, const Exp_T exp) -> T
|
|
76
|
-
{
|
|
77
|
-
// If the exponent is 0, return 1, otherwise recurse.
|
|
78
|
-
return exp ? T (base * pow (base, exp - Exp_T (1))) : T (1);
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
/**
|
|
82
|
-
* @brief Compute the integral value of a number represented as
|
|
83
|
-
* an array of characters.
|
|
84
|
-
*/
|
|
85
|
-
template <class T, char... Cs>
|
|
86
|
-
[[nodiscard]] constexpr auto
|
|
87
|
-
num () -> T
|
|
88
|
-
{
|
|
89
|
-
// Assume all are digits or dot or apostrophe.
|
|
90
|
-
static_assert (
|
|
91
|
-
((Cs == '.' or Cs == '\'' or (Cs >= '0' and Cs <= '9')) and ...));
|
|
92
|
-
T result{};
|
|
93
|
-
for (const char c : { Cs... })
|
|
94
|
-
{
|
|
95
|
-
if (c == '.')
|
|
96
|
-
{
|
|
97
|
-
break;
|
|
98
|
-
}
|
|
99
|
-
if (c >= '0' and c <= '9')
|
|
100
|
-
{
|
|
101
|
-
result = result * T (10) + T (c - '0');
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
return result;
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
/**
|
|
108
|
-
* @brief Compute the decimals of a number represented as
|
|
109
|
-
* an array of characters.
|
|
110
|
-
*/
|
|
111
|
-
template <class T, char... Cs>
|
|
112
|
-
[[nodiscard]] constexpr auto
|
|
113
|
-
den () -> T
|
|
114
|
-
{
|
|
115
|
-
constexpr const std::array cs{ Cs... };
|
|
116
|
-
T result{};
|
|
117
|
-
auto i = 0u;
|
|
118
|
-
while (cs[i++] != '.')
|
|
119
|
-
{
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
for (auto j = i; j < sizeof...(Cs); ++j)
|
|
123
|
-
{
|
|
124
|
-
result += pow (T (10), sizeof...(Cs) - j) * T (cs[j] - '0');
|
|
125
|
-
}
|
|
126
|
-
return result;
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
/**
|
|
130
|
-
* @brief Compute the number of decimal places of a number represented as
|
|
131
|
-
* an array of characters.
|
|
132
|
-
*/
|
|
133
|
-
template <class T, char... Cs>
|
|
134
|
-
[[nodiscard]] constexpr auto
|
|
135
|
-
den_size () -> T
|
|
136
|
-
{
|
|
137
|
-
constexpr const std::array cs{ Cs... };
|
|
138
|
-
T i{};
|
|
139
|
-
#if defined(__GNUC__)
|
|
140
|
-
#pragma GCC diagnostic push
|
|
141
|
-
#pragma GCC diagnostic ignored "-Wconversion"
|
|
142
|
-
#endif
|
|
143
|
-
while (cs[i++] != '.')
|
|
144
|
-
#if defined(__GNUC__)
|
|
145
|
-
#pragma GCC diagnostic pop
|
|
146
|
-
#endif
|
|
147
|
-
{
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
return T (sizeof...(Cs)) - i + T (1);
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
/**
|
|
154
|
-
* @brief Compute the number of decimal places of a value,
|
|
155
|
-
* up to 7 digits.
|
|
156
|
-
*/
|
|
157
|
-
template <class T, class Value_T>
|
|
158
|
-
[[nodiscard]] constexpr auto
|
|
159
|
-
den_size (Value_T value) -> T
|
|
160
|
-
{
|
|
161
|
-
constexpr auto precision = Value_T (1e-7);
|
|
162
|
-
T result{};
|
|
163
|
-
Value_T tmp{};
|
|
164
|
-
do
|
|
165
|
-
{
|
|
166
|
-
value *= 10;
|
|
167
|
-
#if defined(__GNUC__)
|
|
168
|
-
#pragma GCC diagnostic push
|
|
169
|
-
#if !defined(__clang__) // GCC only
|
|
170
|
-
#pragma GCC diagnostic ignored "-Warith-conversion"
|
|
171
|
-
#endif
|
|
172
|
-
#if defined(__clang__)
|
|
173
|
-
#pragma clang diagnostic ignored "-Wimplicit-int-float-conversion"
|
|
174
|
-
#endif
|
|
175
|
-
#endif
|
|
176
|
-
tmp = value - T (value);
|
|
177
|
-
#if defined(__GNUC__)
|
|
178
|
-
#pragma GCC diagnostic pop
|
|
179
|
-
#endif
|
|
180
|
-
++result;
|
|
181
|
-
}
|
|
182
|
-
while (tmp > precision);
|
|
183
|
-
|
|
184
|
-
return result;
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
} // namespace math
|
|
188
|
-
|
|
189
|
-
// --------------------------------------------------------------------------
|
|
190
|
-
} // namespace micro_os_plus::micro_test_plus
|
|
191
|
-
|
|
192
|
-
#if defined(__GNUC__)
|
|
193
|
-
#pragma GCC diagnostic pop
|
|
194
|
-
#endif
|
|
195
|
-
|
|
196
|
-
// ----------------------------------------------------------------------------
|
|
197
|
-
|
|
198
|
-
#endif // __cplusplus
|
|
199
|
-
|
|
200
|
-
// ----------------------------------------------------------------------------
|
|
201
|
-
|
|
202
|
-
#endif // MICRO_TEST_PLUS_MATH_H_
|
|
203
|
-
|
|
204
|
-
// ----------------------------------------------------------------------------
|
|
@@ -1,139 +0,0 @@
|
|
|
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
|
|
9
|
-
* be 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
|
-
#ifndef MICRO_TEST_PLUS_REFLECTION_H_
|
|
17
|
-
#define MICRO_TEST_PLUS_REFLECTION_H_
|
|
18
|
-
|
|
19
|
-
// ----------------------------------------------------------------------------
|
|
20
|
-
|
|
21
|
-
#ifdef __cplusplus
|
|
22
|
-
|
|
23
|
-
// ----------------------------------------------------------------------------
|
|
24
|
-
|
|
25
|
-
#include <string_view>
|
|
26
|
-
|
|
27
|
-
#if defined(__cpp_lib_source_location)
|
|
28
|
-
#include <source_location>
|
|
29
|
-
#endif
|
|
30
|
-
|
|
31
|
-
// ----------------------------------------------------------------------------
|
|
32
|
-
|
|
33
|
-
#if defined(__GNUC__)
|
|
34
|
-
#pragma GCC diagnostic push
|
|
35
|
-
#pragma GCC diagnostic ignored "-Wpadded"
|
|
36
|
-
#pragma GCC diagnostic ignored "-Waggregate-return"
|
|
37
|
-
#if defined(__clang__)
|
|
38
|
-
#pragma clang diagnostic ignored "-Wc++98-compat"
|
|
39
|
-
#pragma clang diagnostic ignored "-Wunknown-warning-option"
|
|
40
|
-
#endif
|
|
41
|
-
#endif
|
|
42
|
-
|
|
43
|
-
namespace micro_os_plus::micro_test_plus
|
|
44
|
-
{
|
|
45
|
-
// --------------------------------------------------------------------------
|
|
46
|
-
|
|
47
|
-
namespace reflection
|
|
48
|
-
{
|
|
49
|
-
#if defined(__cpp_lib_source_location)
|
|
50
|
-
using source_location = std::source_location;
|
|
51
|
-
#else
|
|
52
|
-
/**
|
|
53
|
-
* @brief Local implementation of the std::source_location.
|
|
54
|
-
* @headerfile micro-test-plus.h <micro-os-plus/micro-test-plus.h>
|
|
55
|
-
*/
|
|
56
|
-
class source_location
|
|
57
|
-
{
|
|
58
|
-
public:
|
|
59
|
-
[[nodiscard]] static constexpr auto
|
|
60
|
-
current (
|
|
61
|
-
#if (__has_builtin(__builtin_FILE) and __has_builtin(__builtin_LINE))
|
|
62
|
-
const char* file = __builtin_FILE (),
|
|
63
|
-
unsigned int line = __builtin_LINE ()
|
|
64
|
-
#else
|
|
65
|
-
const char* file = "unknown", unsigned int line = {}
|
|
66
|
-
#endif
|
|
67
|
-
) noexcept
|
|
68
|
-
{
|
|
69
|
-
source_location sl{};
|
|
70
|
-
sl.file_ = file;
|
|
71
|
-
sl.line_ = line;
|
|
72
|
-
return sl;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
[[nodiscard]] constexpr auto
|
|
76
|
-
file_name () const noexcept
|
|
77
|
-
{
|
|
78
|
-
return file_;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
[[nodiscard]] constexpr auto
|
|
82
|
-
line () const noexcept
|
|
83
|
-
{
|
|
84
|
-
return line_;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
private:
|
|
88
|
-
const char* file_{ "unknown" };
|
|
89
|
-
unsigned int line_{};
|
|
90
|
-
};
|
|
91
|
-
|
|
92
|
-
#endif
|
|
93
|
-
|
|
94
|
-
const char*
|
|
95
|
-
short_name (const char* name);
|
|
96
|
-
|
|
97
|
-
// TODO: update for the new namespaces.
|
|
98
|
-
|
|
99
|
-
/**
|
|
100
|
-
* @brief Parse the __PRETTY_FUNCTION__ macro to extract the type name.
|
|
101
|
-
*/
|
|
102
|
-
template <class T>
|
|
103
|
-
[[nodiscard]] constexpr auto
|
|
104
|
-
type_name () -> std::string_view
|
|
105
|
-
{
|
|
106
|
-
#if defined(__clang__)
|
|
107
|
-
#pragma GCC diagnostic push
|
|
108
|
-
#pragma clang diagnostic ignored "-Wunsafe-buffer-usage"
|
|
109
|
-
// printf("|%s|%zu|\n", __PRETTY_FUNCTION__, sizeof
|
|
110
|
-
// (__PRETTY_FUNCTION__)); printf("|%s|\n", &__PRETTY_FUNCTION__[78]);
|
|
111
|
-
return { &__PRETTY_FUNCTION__[78], sizeof (__PRETTY_FUNCTION__) - 80 };
|
|
112
|
-
#pragma GCC diagnostic pop
|
|
113
|
-
#elif defined(__GNUC__)
|
|
114
|
-
// printf("|%s|%zu|\n", __PRETTY_FUNCTION__, sizeof
|
|
115
|
-
// (__PRETTY_FUNCTION__)); printf("|%s|\n", &__PRETTY_FUNCTION__[93]);
|
|
116
|
-
return { &__PRETTY_FUNCTION__[93], sizeof (__PRETTY_FUNCTION__) - 144 };
|
|
117
|
-
#else
|
|
118
|
-
#error "Unsupported compiler"
|
|
119
|
-
return "Unsupported compiler";
|
|
120
|
-
#endif
|
|
121
|
-
}
|
|
122
|
-
} // namespace reflection
|
|
123
|
-
|
|
124
|
-
// --------------------------------------------------------------------------
|
|
125
|
-
} // namespace micro_os_plus::micro_test_plus
|
|
126
|
-
|
|
127
|
-
#if defined(__GNUC__)
|
|
128
|
-
#pragma GCC diagnostic pop
|
|
129
|
-
#endif
|
|
130
|
-
|
|
131
|
-
// ----------------------------------------------------------------------------
|
|
132
|
-
|
|
133
|
-
#endif // __cplusplus
|
|
134
|
-
|
|
135
|
-
// ----------------------------------------------------------------------------
|
|
136
|
-
|
|
137
|
-
#endif // MICRO_TEST_PLUS_REFLECTION_H_
|
|
138
|
-
|
|
139
|
-
// ----------------------------------------------------------------------------
|
|
@@ -1,230 +0,0 @@
|
|
|
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
|
|
9
|
-
* be 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
|
-
#ifndef MICRO_TEST_PLUS_TEST_REPORTER_INLINES_H_
|
|
17
|
-
#define MICRO_TEST_PLUS_TEST_REPORTER_INLINES_H_
|
|
18
|
-
|
|
19
|
-
// ----------------------------------------------------------------------------
|
|
20
|
-
|
|
21
|
-
#ifdef __cplusplus
|
|
22
|
-
|
|
23
|
-
// ----------------------------------------------------------------------------
|
|
24
|
-
|
|
25
|
-
#include <stdio.h>
|
|
26
|
-
#include <cstring>
|
|
27
|
-
|
|
28
|
-
// ----------------------------------------------------------------------------
|
|
29
|
-
|
|
30
|
-
#if defined(__GNUC__)
|
|
31
|
-
#pragma GCC diagnostic push
|
|
32
|
-
#pragma GCC diagnostic ignored "-Waggregate-return"
|
|
33
|
-
#if defined(__clang__)
|
|
34
|
-
#pragma clang diagnostic ignored "-Wc++98-compat"
|
|
35
|
-
#pragma clang diagnostic ignored "-Wc++98-compat-pedantic"
|
|
36
|
-
#endif
|
|
37
|
-
#endif
|
|
38
|
-
|
|
39
|
-
namespace micro_os_plus::micro_test_plus
|
|
40
|
-
{
|
|
41
|
-
// --------------------------------------------------------------------------
|
|
42
|
-
|
|
43
|
-
template <typename T>
|
|
44
|
-
test_reporter&
|
|
45
|
-
test_reporter::operator<< (T* v)
|
|
46
|
-
{
|
|
47
|
-
char buff[20];
|
|
48
|
-
snprintf (buff, sizeof (buff), "%p", reinterpret_cast<void*> (v));
|
|
49
|
-
out_.append (buff);
|
|
50
|
-
|
|
51
|
-
return *this;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
#if 0
|
|
55
|
-
template <class T>
|
|
56
|
-
test_reporter&
|
|
57
|
-
test_reporter::operator<< (const T& t)
|
|
58
|
-
{
|
|
59
|
-
*this << detail::get (t);
|
|
60
|
-
return *this;
|
|
61
|
-
}
|
|
62
|
-
#endif
|
|
63
|
-
|
|
64
|
-
template <class T>
|
|
65
|
-
test_reporter&
|
|
66
|
-
test_reporter::operator<< (const type_traits::genuine_integral_value<T>& v)
|
|
67
|
-
{
|
|
68
|
-
out_.append (std::to_string (static_cast<long long> (v.get ())));
|
|
69
|
-
return *this;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
template <class T,
|
|
73
|
-
type_traits::requires_t<type_traits::is_container_v<T>
|
|
74
|
-
and not type_traits::has_npos_v<T>>>
|
|
75
|
-
test_reporter&
|
|
76
|
-
test_reporter::operator<< (T&& t)
|
|
77
|
-
{
|
|
78
|
-
*this << '{';
|
|
79
|
-
auto first = true;
|
|
80
|
-
for (const auto& arg : t)
|
|
81
|
-
{
|
|
82
|
-
*this << (first ? "" : ", ") << arg;
|
|
83
|
-
first = false;
|
|
84
|
-
}
|
|
85
|
-
*this << '}';
|
|
86
|
-
return *this;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
template <class Lhs_T, class Rhs_T>
|
|
90
|
-
test_reporter&
|
|
91
|
-
test_reporter::operator<< (const detail::eq_<Lhs_T, Rhs_T>& op)
|
|
92
|
-
{
|
|
93
|
-
return (*this << color (op) << op.lhs () << " == " << op.rhs ()
|
|
94
|
-
<< colors_.none);
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
template <class Lhs_T, class Rhs_T>
|
|
98
|
-
test_reporter&
|
|
99
|
-
test_reporter::operator<< (const detail::ne_<Lhs_T, Rhs_T>& op)
|
|
100
|
-
{
|
|
101
|
-
return (*this << color (op) << op.lhs () << " != " << op.rhs ()
|
|
102
|
-
<< colors_.none);
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
template <class Lhs_T, class Rhs_T>
|
|
106
|
-
test_reporter&
|
|
107
|
-
test_reporter::operator<< (const detail::gt_<Lhs_T, Rhs_T>& op)
|
|
108
|
-
{
|
|
109
|
-
return (*this << color (op) << op.lhs () << " > " << op.rhs ()
|
|
110
|
-
<< colors_.none);
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
template <class Lhs_T, class Rhs_T>
|
|
114
|
-
test_reporter&
|
|
115
|
-
test_reporter::operator<< (const detail::ge_<Lhs_T, Rhs_T>& op)
|
|
116
|
-
{
|
|
117
|
-
return (*this << color (op) << op.lhs () << " >= " << op.rhs ()
|
|
118
|
-
<< colors_.none);
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
template <class Lhs_T, class Rhs_T>
|
|
122
|
-
test_reporter&
|
|
123
|
-
test_reporter::operator<< (const detail::lt_<Rhs_T, Lhs_T>& op)
|
|
124
|
-
{
|
|
125
|
-
return (*this << color (op) << op.lhs () << " < " << op.rhs ()
|
|
126
|
-
<< colors_.none);
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
template <class Lhs_T, class Rhs_T>
|
|
130
|
-
test_reporter&
|
|
131
|
-
test_reporter::operator<< (const detail::le_<Rhs_T, Lhs_T>& op)
|
|
132
|
-
{
|
|
133
|
-
return (*this << color (op) << op.lhs () << " <= " << op.rhs ()
|
|
134
|
-
<< colors_.none);
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
template <class Lhs_T, class Rhs_T>
|
|
138
|
-
test_reporter&
|
|
139
|
-
test_reporter::operator<< (const detail::and_<Lhs_T, Rhs_T>& op)
|
|
140
|
-
{
|
|
141
|
-
return (*this << '(' << op.lhs () << color (op) << " and " << colors_.none
|
|
142
|
-
<< op.rhs () << ')');
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
template <class Lhs_T, class Rhs_T>
|
|
146
|
-
test_reporter&
|
|
147
|
-
test_reporter::operator<< (const detail::or_<Lhs_T, Rhs_T>& op)
|
|
148
|
-
{
|
|
149
|
-
return (*this << '(' << op.lhs () << color (op) << " or " << colors_.none
|
|
150
|
-
<< op.rhs () << ')');
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
template <class T>
|
|
154
|
-
test_reporter&
|
|
155
|
-
test_reporter::operator<< (const detail::not_<T>& op)
|
|
156
|
-
{
|
|
157
|
-
return (*this << color (op) << "not " << op.value () << colors_.none);
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
#if defined(__cpp_exceptions)
|
|
161
|
-
template <class Expr_T, class Exception_T>
|
|
162
|
-
test_reporter&
|
|
163
|
-
test_reporter::operator<< (const detail::throws_<Expr_T, Exception_T>& op)
|
|
164
|
-
{
|
|
165
|
-
return (*this << color (op) << "throws<"
|
|
166
|
-
<< reflection::type_name<Exception_T> () << ">"
|
|
167
|
-
<< colors_.none);
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
template <class Expr_T>
|
|
171
|
-
test_reporter&
|
|
172
|
-
test_reporter::operator<< (const detail::throws_<Expr_T, void>& op)
|
|
173
|
-
{
|
|
174
|
-
return (*this << color (op) << "throws" << colors_.none);
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
template <class Expr_T>
|
|
178
|
-
test_reporter&
|
|
179
|
-
test_reporter::operator<< (const detail::nothrow_<Expr_T>& op)
|
|
180
|
-
{
|
|
181
|
-
return (*this << color (op) << "nothrow" << colors_.none);
|
|
182
|
-
}
|
|
183
|
-
#endif
|
|
184
|
-
|
|
185
|
-
template <class Expr_T>
|
|
186
|
-
void
|
|
187
|
-
test_reporter::pass (Expr_T& expr, std::string& message)
|
|
188
|
-
{
|
|
189
|
-
output_pass_prefix_ (message);
|
|
190
|
-
|
|
191
|
-
if (message.empty ())
|
|
192
|
-
{
|
|
193
|
-
// If there is no message, display the evaluated expression.
|
|
194
|
-
*this << expr;
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
output_pass_suffix_ ();
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
template <class Expr_T>
|
|
201
|
-
void
|
|
202
|
-
test_reporter::fail (Expr_T& expr, bool abort, std::string& message,
|
|
203
|
-
const reflection::source_location& location)
|
|
204
|
-
{
|
|
205
|
-
output_fail_prefix_ (message, location);
|
|
206
|
-
|
|
207
|
-
if constexpr (type_traits::is_op_v<Expr_T>)
|
|
208
|
-
{
|
|
209
|
-
*this << ", " << expr;
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
output_fail_suffix_ (abort);
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
// --------------------------------------------------------------------------
|
|
216
|
-
} // namespace micro_os_plus::micro_test_plus
|
|
217
|
-
|
|
218
|
-
#if defined(__GNUC__)
|
|
219
|
-
#pragma GCC diagnostic pop
|
|
220
|
-
#endif
|
|
221
|
-
|
|
222
|
-
// ----------------------------------------------------------------------------
|
|
223
|
-
|
|
224
|
-
#endif // __cplusplus
|
|
225
|
-
|
|
226
|
-
// ----------------------------------------------------------------------------
|
|
227
|
-
|
|
228
|
-
#endif // MICRO_TEST_PLUS_TEST_REPORTER_INLINES_H_
|
|
229
|
-
|
|
230
|
-
// ----------------------------------------------------------------------------
|