@micro-os-plus/micro-test-plus 3.3.1 → 4.1.0
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/CHANGELOG.md +412 -2
- package/CMakeLists.txt +134 -28
- package/README.md +3 -2
- package/config/xcdl-build.json +11 -4
- package/include/micro-os-plus/micro-test-plus/README.md +6 -0
- package/include/micro-os-plus/micro-test-plus/deferred-reporter.h +267 -0
- package/include/micro-os-plus/micro-test-plus/detail.h +272 -1425
- package/include/micro-os-plus/micro-test-plus/exceptions.h +125 -0
- package/include/micro-os-plus/micro-test-plus/expression-formatter.h +669 -0
- package/include/micro-os-plus/micro-test-plus/function-comparators.h +15 -7
- package/include/micro-os-plus/micro-test-plus/inlines/{details-inlines.h → deferred-reporter-inlines.h} +66 -44
- package/include/micro-os-plus/micro-test-plus/inlines/detail-inlines.h +711 -0
- package/include/micro-os-plus/micro-test-plus/inlines/exceptions-inline.h +137 -0
- package/include/micro-os-plus/micro-test-plus/inlines/{test-reporter-inlines.h → expression-formatter-inlines.h} +232 -198
- package/include/micro-os-plus/micro-test-plus/inlines/function-comparators-inlines.h +24 -20
- package/include/micro-os-plus/micro-test-plus/inlines/literals-inlines.h +50 -31
- package/include/micro-os-plus/micro-test-plus/inlines/math-inlines.h +25 -19
- package/include/micro-os-plus/micro-test-plus/inlines/operators-inlines.h +275 -0
- package/include/micro-os-plus/micro-test-plus/inlines/reflection-inlines.h +39 -21
- package/include/micro-os-plus/micro-test-plus/inlines/reporter-inlines.h +205 -0
- package/include/micro-os-plus/micro-test-plus/inlines/runner-inlines.h +151 -0
- package/include/micro-os-plus/micro-test-plus/inlines/runner-totals-inlines.h +152 -0
- package/include/micro-os-plus/micro-test-plus/inlines/test-inlines.h +555 -0
- package/include/micro-os-plus/micro-test-plus/inlines/timings-inlines.h +120 -0
- package/include/micro-os-plus/micro-test-plus/inlines/type-traits-inlines.h +231 -0
- package/include/micro-os-plus/micro-test-plus/inlines/utility-inlines.h +126 -0
- package/include/micro-os-plus/micro-test-plus/literals.h +12 -17
- package/include/micro-os-plus/micro-test-plus/math.h +14 -6
- package/include/micro-os-plus/micro-test-plus/operators.h +53 -209
- package/include/micro-os-plus/micro-test-plus/reflection.h +8 -4
- package/include/micro-os-plus/micro-test-plus/{test-reporter-basic.h → reporter-human.h} +80 -74
- package/include/micro-os-plus/micro-test-plus/{test-reporter-tap.h → reporter-tap.h} +77 -71
- package/include/micro-os-plus/micro-test-plus/reporter.h +619 -0
- package/include/micro-os-plus/micro-test-plus/runner-totals.h +250 -0
- package/include/micro-os-plus/micro-test-plus/runner.h +472 -0
- package/include/micro-os-plus/micro-test-plus/test.h +1013 -0
- package/include/micro-os-plus/micro-test-plus/timings.h +363 -0
- package/include/micro-os-plus/micro-test-plus/type-traits.h +223 -577
- package/include/micro-os-plus/micro-test-plus/utility.h +136 -0
- package/include/micro-os-plus/micro-test-plus.h +42 -236
- package/meson.build +11 -6
- package/package.json +11 -3
- package/src/deferred-reporter.cpp +137 -0
- package/src/expression-formatter.cpp +289 -0
- package/src/reflection.cpp +97 -0
- package/src/reporter-human.cpp +816 -0
- package/src/reporter-tap.cpp +772 -0
- package/src/reporter.cpp +481 -0
- package/src/runner-totals.cpp +98 -0
- package/src/runner.cpp +669 -0
- package/src/test.cpp +503 -0
- package/src/timings.cpp +210 -0
- package/src/utility.cpp +163 -0
- package/.cmake-format.yaml +0 -11
- package/include/micro-os-plus/micro-test-plus/inlines/micro-test-plus-inlines.h +0 -313
- package/include/micro-os-plus/micro-test-plus/inlines/test-suite-inlines.h +0 -115
- package/include/micro-os-plus/micro-test-plus/test-reporter.h +0 -846
- package/include/micro-os-plus/micro-test-plus/test-runner.h +0 -281
- package/include/micro-os-plus/micro-test-plus/test-suite.h +0 -492
- package/src/micro-test-plus.cpp +0 -316
- package/src/test-reporter-basic.cpp +0 -466
- package/src/test-reporter-tap.cpp +0 -530
- package/src/test-reporter.cpp +0 -399
- package/src/test-runner.cpp +0 -311
- package/src/test-suite.cpp +0 -304
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
|
|
55
55
|
#include <string_view>
|
|
56
56
|
|
|
57
|
-
#include "
|
|
57
|
+
#include "type-traits.h"
|
|
58
58
|
|
|
59
59
|
// ----------------------------------------------------------------------------
|
|
60
60
|
|
|
@@ -64,10 +64,11 @@
|
|
|
64
64
|
#pragma GCC diagnostic ignored "-Waggregate-return"
|
|
65
65
|
#if defined(__clang__)
|
|
66
66
|
#pragma clang diagnostic ignored "-Wc++98-compat"
|
|
67
|
-
#pragma clang diagnostic ignored "-Wunknown-warning-option"
|
|
68
67
|
#endif
|
|
69
68
|
#endif
|
|
70
69
|
|
|
70
|
+
// ===========================================================================
|
|
71
|
+
|
|
71
72
|
namespace micro_os_plus::micro_test_plus
|
|
72
73
|
{
|
|
73
74
|
// --------------------------------------------------------------------------
|
|
@@ -106,9 +107,6 @@ namespace micro_os_plus::micro_test_plus
|
|
|
106
107
|
*/
|
|
107
108
|
namespace operators
|
|
108
109
|
{
|
|
109
|
-
// In order to simplify things and use the return type `auto`,
|
|
110
|
-
// the definition must be included before any use.
|
|
111
|
-
|
|
112
110
|
/**
|
|
113
111
|
* @ingroup micro-test-plus-string-operators
|
|
114
112
|
* @brief Equality operator for `string_view` objects.
|
|
@@ -117,18 +115,9 @@ namespace micro_os_plus::micro_test_plus
|
|
|
117
115
|
* @param [in] rhs The right hand side `std::string_view` operand.
|
|
118
116
|
* @return A comparator object that evaluates to true if the string views
|
|
119
117
|
* are equal.
|
|
120
|
-
*
|
|
121
|
-
* @details
|
|
122
|
-
* This overload of the equality operator enables direct comparison of two
|
|
123
|
-
* `std::string_view` objects within the µTest++ framework. It constructs a
|
|
124
|
-
* comparator object that can be used in test expectations and assertions
|
|
125
|
-
* to verify that two string views are equal.
|
|
126
118
|
*/
|
|
127
119
|
[[nodiscard]] constexpr auto
|
|
128
|
-
operator== (std::string_view lhs, std::string_view rhs)
|
|
129
|
-
{
|
|
130
|
-
return detail::eq_{ lhs, rhs };
|
|
131
|
-
}
|
|
120
|
+
operator== (std::string_view lhs, std::string_view rhs);
|
|
132
121
|
|
|
133
122
|
/**
|
|
134
123
|
* @ingroup micro-test-plus-string-operators
|
|
@@ -138,74 +127,49 @@ namespace micro_os_plus::micro_test_plus
|
|
|
138
127
|
* @param [in] rhs The right hand side `std::string_view` operand.
|
|
139
128
|
* @return A comparator object that evaluates to true if the string views
|
|
140
129
|
* are not equal.
|
|
141
|
-
*
|
|
142
|
-
* @details
|
|
143
|
-
* This overload of the non-equality operator enables direct comparison of
|
|
144
|
-
* two `std::string_view` objects within the µTest++ framework. It
|
|
145
|
-
* constructs a comparator object that can be used in test expectations and
|
|
146
|
-
* assertions to verify that two string views are not equal.
|
|
147
130
|
*/
|
|
148
131
|
[[nodiscard]] constexpr auto
|
|
149
|
-
operator!= (std::string_view lhs, std::string_view rhs)
|
|
150
|
-
{
|
|
151
|
-
return detail::ne_{ lhs, rhs };
|
|
152
|
-
}
|
|
132
|
+
operator!= (std::string_view lhs, std::string_view rhs);
|
|
153
133
|
|
|
154
134
|
/**
|
|
155
135
|
* @ingroup micro-test-plus-container-operators
|
|
156
136
|
* @brief Equality operator for containers.
|
|
157
137
|
*
|
|
158
|
-
* @tparam
|
|
138
|
+
* @tparam Lhs_T The left-hand container type, constrained to recognised
|
|
139
|
+
* container types.
|
|
140
|
+
* @tparam Rhs_T The right-hand container type, constrained to recognised
|
|
141
|
+
* container types.
|
|
159
142
|
*
|
|
160
143
|
* @param [in] lhs The left hand side container operand.
|
|
161
144
|
* @param [in] rhs The right hand side container operand.
|
|
162
145
|
* @return A comparator object that evaluates to true if the containers are
|
|
163
146
|
* equal.
|
|
164
|
-
*
|
|
165
|
-
* @details
|
|
166
|
-
* This overload of the equality operator enables direct comparison of two
|
|
167
|
-
* container objects within the µTest++ framework. It constructs a
|
|
168
|
-
* comparator object that can be used in test expectations and assertions
|
|
169
|
-
* to verify that two containers are equal in content and order.
|
|
170
|
-
*
|
|
171
|
-
* The operator is enabled only for types recognised as containers by the
|
|
172
|
-
* framework's type traits.
|
|
173
147
|
*/
|
|
174
|
-
template <class
|
|
175
|
-
|
|
148
|
+
template <class Lhs_T, class Rhs_T>
|
|
149
|
+
requires (type_traits::container_like<Lhs_T>
|
|
150
|
+
and type_traits::container_like<Rhs_T>)
|
|
176
151
|
[[nodiscard]] constexpr auto
|
|
177
|
-
operator== (
|
|
178
|
-
{
|
|
179
|
-
return detail::eq_{ static_cast<T&&> (lhs), static_cast<T&&> (rhs) };
|
|
180
|
-
}
|
|
152
|
+
operator== (const Lhs_T& lhs, const Rhs_T& rhs);
|
|
181
153
|
|
|
182
154
|
/**
|
|
183
155
|
* @ingroup micro-test-plus-container-operators
|
|
184
156
|
* @brief Non-equality operator for containers.
|
|
185
157
|
*
|
|
186
|
-
* @tparam
|
|
158
|
+
* @tparam Lhs_T The left-hand container type, constrained to recognised
|
|
159
|
+
* container types.
|
|
160
|
+
* @tparam Rhs_T The right-hand container type, constrained to recognised
|
|
161
|
+
* container types.
|
|
187
162
|
*
|
|
188
163
|
* @param [in] lhs The left hand side container operand.
|
|
189
164
|
* @param [in] rhs The right hand side container operand.
|
|
190
165
|
* @return A comparator object that evaluates to true if the containers are
|
|
191
166
|
* not equal.
|
|
192
|
-
*
|
|
193
|
-
* @details
|
|
194
|
-
* This overload of the non-equality operator enables direct comparison of
|
|
195
|
-
* two container objects within the µTest++ framework. It constructs a
|
|
196
|
-
* comparator object that can be used in test expectations and assertions
|
|
197
|
-
* to verify that two containers are not equal in content or order.
|
|
198
|
-
*
|
|
199
|
-
* The operator is enabled only for types recognised as containers by the
|
|
200
|
-
* framework's type traits.
|
|
201
167
|
*/
|
|
202
|
-
template <class
|
|
203
|
-
|
|
168
|
+
template <class Lhs_T, class Rhs_T>
|
|
169
|
+
requires (type_traits::container_like<Lhs_T>
|
|
170
|
+
and type_traits::container_like<Rhs_T>)
|
|
204
171
|
[[nodiscard]] constexpr auto
|
|
205
|
-
operator!= (
|
|
206
|
-
{
|
|
207
|
-
return detail::ne_{ static_cast<T&&> (lhs), static_cast<T&&> (rhs) };
|
|
208
|
-
}
|
|
172
|
+
operator!= (const Lhs_T& lhs, const Rhs_T& rhs);
|
|
209
173
|
|
|
210
174
|
/**
|
|
211
175
|
* @ingroup micro-test-plus-operators
|
|
@@ -219,25 +183,11 @@ namespace micro_os_plus::micro_test_plus
|
|
|
219
183
|
* @param [in] rhs Right hand side operand.
|
|
220
184
|
* @return A comparator object that evaluates to true if the operands are
|
|
221
185
|
* equal.
|
|
222
|
-
*
|
|
223
|
-
* @details
|
|
224
|
-
* This overload of the equality operator enables comparison between two
|
|
225
|
-
* operands, where at least one is a local type derived from the local `op`
|
|
226
|
-
* base. It constructs a comparator object that can be used within the
|
|
227
|
-
* µTest++ framework to assert that the operands are equal. This operator
|
|
228
|
-
* is intended for use with the framework's strongly-typed constants,
|
|
229
|
-
* wrappers, or other custom types, ensuring type-safe and expressive test
|
|
230
|
-
* assertions.
|
|
231
186
|
*/
|
|
232
|
-
template <class Lhs_T, class Rhs_T
|
|
233
|
-
|
|
234
|
-
or type_traits::is_op_v<Rhs_T>>
|
|
235
|
-
= 0>
|
|
187
|
+
template <class Lhs_T, class Rhs_T>
|
|
188
|
+
requires type_traits::any_op<Lhs_T, Rhs_T>
|
|
236
189
|
[[nodiscard]] constexpr auto
|
|
237
|
-
operator== (const Lhs_T& lhs, const Rhs_T& rhs)
|
|
238
|
-
{
|
|
239
|
-
return detail::eq_{ lhs, rhs };
|
|
240
|
-
}
|
|
190
|
+
operator== (const Lhs_T& lhs, const Rhs_T& rhs);
|
|
241
191
|
|
|
242
192
|
/**
|
|
243
193
|
* @ingroup micro-test-plus-operators
|
|
@@ -251,25 +201,11 @@ namespace micro_os_plus::micro_test_plus
|
|
|
251
201
|
* @param [in] rhs Right hand side operand.
|
|
252
202
|
* @return A comparator object that evaluates to true if the operands are
|
|
253
203
|
* not equal.
|
|
254
|
-
*
|
|
255
|
-
* @details
|
|
256
|
-
* This overload of the non-equality operator enables comparison between
|
|
257
|
-
* two operands, where at least one is a local type derived from the local
|
|
258
|
-
* `op` base. It constructs a comparator object that can be used within the
|
|
259
|
-
* µTest++ framework to assert that the operands are not equal. This
|
|
260
|
-
* operator is intended for use with the framework's strongly-typed
|
|
261
|
-
* constants, wrappers, or other custom types, ensuring type-safe and
|
|
262
|
-
* expressive test assertions.
|
|
263
204
|
*/
|
|
264
|
-
template <class Lhs_T, class Rhs_T
|
|
265
|
-
|
|
266
|
-
or type_traits::is_op_v<Rhs_T>>
|
|
267
|
-
= 0>
|
|
205
|
+
template <class Lhs_T, class Rhs_T>
|
|
206
|
+
requires type_traits::any_op<Lhs_T, Rhs_T>
|
|
268
207
|
[[nodiscard]] constexpr auto
|
|
269
|
-
operator!= (const Lhs_T& lhs, const Rhs_T& rhs)
|
|
270
|
-
{
|
|
271
|
-
return detail::ne_{ lhs, rhs };
|
|
272
|
-
}
|
|
208
|
+
operator!= (const Lhs_T& lhs, const Rhs_T& rhs);
|
|
273
209
|
|
|
274
210
|
/**
|
|
275
211
|
* @ingroup micro-test-plus-operators
|
|
@@ -283,25 +219,11 @@ namespace micro_os_plus::micro_test_plus
|
|
|
283
219
|
* @param [in] rhs Right hand side operand.
|
|
284
220
|
* @return A comparator object that evaluates to true if the left hand side
|
|
285
221
|
* operand is greater than the right hand side operand.
|
|
286
|
-
*
|
|
287
|
-
* @details
|
|
288
|
-
* This overload of the greater than operator enables comparison between
|
|
289
|
-
* two operands, where at least one is a local type derived from the local
|
|
290
|
-
* `op` base. It constructs a comparator object that can be used within the
|
|
291
|
-
* µTest++ framework to assert that the left hand side operand is greater
|
|
292
|
-
* than the right hand side operand. This operator is intended for use with
|
|
293
|
-
* the framework's strongly-typed constants, wrappers, or other custom
|
|
294
|
-
* types, ensuring type-safe and expressive test assertions.
|
|
295
222
|
*/
|
|
296
|
-
template <class Lhs_T, class Rhs_T
|
|
297
|
-
|
|
298
|
-
or type_traits::is_op_v<Rhs_T>>
|
|
299
|
-
= 0>
|
|
223
|
+
template <class Lhs_T, class Rhs_T>
|
|
224
|
+
requires type_traits::any_op<Lhs_T, Rhs_T>
|
|
300
225
|
[[nodiscard]] constexpr auto
|
|
301
|
-
operator> (const Lhs_T& lhs, const Rhs_T& rhs)
|
|
302
|
-
{
|
|
303
|
-
return detail::gt_{ lhs, rhs };
|
|
304
|
-
}
|
|
226
|
+
operator> (const Lhs_T& lhs, const Rhs_T& rhs);
|
|
305
227
|
|
|
306
228
|
/**
|
|
307
229
|
* @ingroup micro-test-plus-operators
|
|
@@ -315,26 +237,11 @@ namespace micro_os_plus::micro_test_plus
|
|
|
315
237
|
* @param [in] rhs Right hand side operand.
|
|
316
238
|
* @return A comparator object that evaluates to true if the left hand side
|
|
317
239
|
* operand is greater than or equal to the right hand side operand.
|
|
318
|
-
*
|
|
319
|
-
* @details
|
|
320
|
-
* This overload of the greater than or equal operator enables comparison
|
|
321
|
-
* between two operands, where at least one is a local type derived from
|
|
322
|
-
* the local `op` base. It constructs a comparator object that can be used
|
|
323
|
-
* within the µTest++ framework to assert that the left hand side operand
|
|
324
|
-
* is greater than or equal to the right hand side operand. This operator
|
|
325
|
-
* is intended for use with the framework's strongly-typed constants,
|
|
326
|
-
* wrappers, or other custom types, ensuring type-safe and expressive test
|
|
327
|
-
* assertions.
|
|
328
240
|
*/
|
|
329
|
-
template <class Lhs_T, class Rhs_T
|
|
330
|
-
|
|
331
|
-
or type_traits::is_op_v<Rhs_T>>
|
|
332
|
-
= 0>
|
|
241
|
+
template <class Lhs_T, class Rhs_T>
|
|
242
|
+
requires type_traits::any_op<Lhs_T, Rhs_T>
|
|
333
243
|
[[nodiscard]] constexpr auto
|
|
334
|
-
operator>= (const Lhs_T& lhs, const Rhs_T& rhs)
|
|
335
|
-
{
|
|
336
|
-
return detail::ge_{ lhs, rhs };
|
|
337
|
-
}
|
|
244
|
+
operator>= (const Lhs_T& lhs, const Rhs_T& rhs);
|
|
338
245
|
|
|
339
246
|
/**
|
|
340
247
|
* @ingroup micro-test-plus-operators
|
|
@@ -348,25 +255,11 @@ namespace micro_os_plus::micro_test_plus
|
|
|
348
255
|
* @param [in] rhs Right hand side operand.
|
|
349
256
|
* @return A comparator object that evaluates to true if the left hand side
|
|
350
257
|
* operand is less than the right hand side operand.
|
|
351
|
-
*
|
|
352
|
-
* @details
|
|
353
|
-
* This overload of the less than operator enables comparison between two
|
|
354
|
-
* operands, where at least one is a local type derived from the local `op`
|
|
355
|
-
* base. It constructs a comparator object that can be used within the
|
|
356
|
-
* µTest++ framework to assert that the left hand side operand is less than
|
|
357
|
-
* the right hand side operand. This operator is intended for use with the
|
|
358
|
-
* framework's strongly-typed constants, wrappers, or other custom types,
|
|
359
|
-
* ensuring type-safe and expressive test assertions.
|
|
360
258
|
*/
|
|
361
|
-
template <class Lhs_T, class Rhs_T
|
|
362
|
-
|
|
363
|
-
or type_traits::is_op_v<Rhs_T>>
|
|
364
|
-
= 0>
|
|
259
|
+
template <class Lhs_T, class Rhs_T>
|
|
260
|
+
requires type_traits::any_op<Lhs_T, Rhs_T>
|
|
365
261
|
[[nodiscard]] constexpr auto
|
|
366
|
-
operator< (const Lhs_T& lhs, const Rhs_T& rhs)
|
|
367
|
-
{
|
|
368
|
-
return detail::lt_{ lhs, rhs };
|
|
369
|
-
}
|
|
262
|
+
operator< (const Lhs_T& lhs, const Rhs_T& rhs);
|
|
370
263
|
|
|
371
264
|
/**
|
|
372
265
|
* @ingroup micro-test-plus-operators
|
|
@@ -380,26 +273,11 @@ namespace micro_os_plus::micro_test_plus
|
|
|
380
273
|
* @param [in] rhs Right hand side operand.
|
|
381
274
|
* @return A comparator object that evaluates to true if the left hand side
|
|
382
275
|
* operand is less than or equal to the right hand side operand.
|
|
383
|
-
*
|
|
384
|
-
* @details
|
|
385
|
-
* This overload of the less than or equal operator enables comparison
|
|
386
|
-
* between two operands, where at least one is a local type derived from
|
|
387
|
-
* the local `op` base. It constructs a comparator object that can be used
|
|
388
|
-
* within the µTest++ framework to assert that the left hand side operand
|
|
389
|
-
* is less than or equal to the right hand side operand. This operator is
|
|
390
|
-
* intended for use with the framework's strongly-typed constants,
|
|
391
|
-
* wrappers, or other custom types, ensuring type-safe and expressive test
|
|
392
|
-
* assertions.
|
|
393
276
|
*/
|
|
394
|
-
template <class Lhs_T, class Rhs_T
|
|
395
|
-
|
|
396
|
-
or type_traits::is_op_v<Rhs_T>>
|
|
397
|
-
= 0>
|
|
277
|
+
template <class Lhs_T, class Rhs_T>
|
|
278
|
+
requires type_traits::any_op<Lhs_T, Rhs_T>
|
|
398
279
|
[[nodiscard]] constexpr auto
|
|
399
|
-
operator<= (const Lhs_T& lhs, const Rhs_T& rhs)
|
|
400
|
-
{
|
|
401
|
-
return detail::le_{ lhs, rhs };
|
|
402
|
-
}
|
|
280
|
+
operator<= (const Lhs_T& lhs, const Rhs_T& rhs);
|
|
403
281
|
|
|
404
282
|
/**
|
|
405
283
|
* @ingroup micro-test-plus-operators
|
|
@@ -413,25 +291,11 @@ namespace micro_os_plus::micro_test_plus
|
|
|
413
291
|
* @param [in] rhs Right hand side operand.
|
|
414
292
|
* @return A logical conjunction object that evaluates to true if both
|
|
415
293
|
* operands are true.
|
|
416
|
-
*
|
|
417
|
-
* @details
|
|
418
|
-
* This overload of the logical `&&` (and) operator enables conjunction
|
|
419
|
-
* between two operands, where at least one is a local type derived from
|
|
420
|
-
* the local `op` base. It constructs a logical conjunction object that can
|
|
421
|
-
* be used within the µTest++ framework to assert that both operands
|
|
422
|
-
* evaluate to true. This operator is intended for use with the framework's
|
|
423
|
-
* strongly-typed constants, wrappers, or other custom types, ensuring
|
|
424
|
-
* type-safe and expressive test assertions.
|
|
425
294
|
*/
|
|
426
|
-
template <class Lhs_T, class Rhs_T
|
|
427
|
-
|
|
428
|
-
or type_traits::is_op_v<Rhs_T>>
|
|
429
|
-
= 0>
|
|
295
|
+
template <class Lhs_T, class Rhs_T>
|
|
296
|
+
requires type_traits::any_op<Lhs_T, Rhs_T>
|
|
430
297
|
[[nodiscard]] constexpr auto
|
|
431
|
-
operator and (const Lhs_T& lhs, const Rhs_T& rhs)
|
|
432
|
-
{
|
|
433
|
-
return detail::and_{ lhs, rhs };
|
|
434
|
-
}
|
|
298
|
+
operator and (const Lhs_T& lhs, const Rhs_T& rhs);
|
|
435
299
|
|
|
436
300
|
/**
|
|
437
301
|
* @ingroup micro-test-plus-operators
|
|
@@ -445,25 +309,11 @@ namespace micro_os_plus::micro_test_plus
|
|
|
445
309
|
* @param [in] rhs Right hand side operand.
|
|
446
310
|
* @return A logical disjunction object that evaluates to true if at least
|
|
447
311
|
* one operand is true.
|
|
448
|
-
*
|
|
449
|
-
* @details
|
|
450
|
-
* This overload of the logical `||` (or) operator enables disjunction
|
|
451
|
-
* between two operands, where at least one is a local type derived from
|
|
452
|
-
* the local `op` base. It constructs a logical disjunction object that can
|
|
453
|
-
* be used within the µTest++ framework to assert that at least one operand
|
|
454
|
-
* evaluates to true. This operator is intended for use with the
|
|
455
|
-
* framework's strongly-typed constants, wrappers, or other custom types,
|
|
456
|
-
* ensuring type-safe and expressive test assertions.
|
|
457
312
|
*/
|
|
458
|
-
template <class Lhs_T, class Rhs_T
|
|
459
|
-
|
|
460
|
-
or type_traits::is_op_v<Rhs_T>>
|
|
461
|
-
= 0>
|
|
313
|
+
template <class Lhs_T, class Rhs_T>
|
|
314
|
+
requires type_traits::any_op<Lhs_T, Rhs_T>
|
|
462
315
|
[[nodiscard]] constexpr auto
|
|
463
|
-
operator or (const Lhs_T& lhs, const Rhs_T& rhs)
|
|
464
|
-
{
|
|
465
|
-
return detail::or_{ lhs, rhs };
|
|
466
|
-
}
|
|
316
|
+
operator or (const Lhs_T& lhs, const Rhs_T& rhs);
|
|
467
317
|
|
|
468
318
|
/**
|
|
469
319
|
* @ingroup micro-test-plus-operators
|
|
@@ -476,22 +326,11 @@ namespace micro_os_plus::micro_test_plus
|
|
|
476
326
|
* @param [in] t Operand to be logically negated.
|
|
477
327
|
* @return A logical negator object that evaluates to true if the operand
|
|
478
328
|
* is false.
|
|
479
|
-
*
|
|
480
|
-
* @details
|
|
481
|
-
* This overload of the logical `!` (not) operator enables logical negation
|
|
482
|
-
* of an operand, provided it is a local type derived from the local `op`
|
|
483
|
-
* base. It constructs a logical negator object that can be used within the
|
|
484
|
-
* µTest++ framework to assert that a given condition is false. This
|
|
485
|
-
* operator is intended for use with the framework's strongly-typed
|
|
486
|
-
* constants, wrappers, or other custom types, ensuring type-safe and
|
|
487
|
-
* expressive test assertions.
|
|
488
329
|
*/
|
|
489
|
-
template <class T
|
|
330
|
+
template <class T>
|
|
331
|
+
requires type_traits::is_op<T>
|
|
490
332
|
[[nodiscard]] constexpr auto
|
|
491
|
-
operator not(const T& t)
|
|
492
|
-
{
|
|
493
|
-
return detail::not_{ t };
|
|
494
|
-
}
|
|
333
|
+
operator not(const T& t);
|
|
495
334
|
|
|
496
335
|
// ------------------------------------------------------------------------
|
|
497
336
|
} // namespace operators
|
|
@@ -507,6 +346,11 @@ namespace micro_os_plus::micro_test_plus
|
|
|
507
346
|
|
|
508
347
|
#endif // __cplusplus
|
|
509
348
|
|
|
349
|
+
// ============================================================================
|
|
350
|
+
// Templates & constexpr implementations.
|
|
351
|
+
|
|
352
|
+
#include "inlines/operators-inlines.h"
|
|
353
|
+
|
|
510
354
|
// ----------------------------------------------------------------------------
|
|
511
355
|
|
|
512
356
|
#endif // MICRO_TEST_PLUS_OPERATORS_H_
|
|
@@ -68,10 +68,11 @@
|
|
|
68
68
|
#pragma GCC diagnostic ignored "-Waggregate-return"
|
|
69
69
|
#if defined(__clang__)
|
|
70
70
|
#pragma clang diagnostic ignored "-Wc++98-compat"
|
|
71
|
-
#pragma clang diagnostic ignored "-Wunknown-warning-option"
|
|
72
71
|
#endif
|
|
73
72
|
#endif
|
|
74
73
|
|
|
74
|
+
// =============================================================================
|
|
75
|
+
|
|
75
76
|
namespace micro_os_plus::micro_test_plus
|
|
76
77
|
{
|
|
77
78
|
// --------------------------------------------------------------------------
|
|
@@ -195,9 +196,7 @@ namespace micro_os_plus::micro_test_plus
|
|
|
195
196
|
* @return A pointer to the short name within the input string.
|
|
196
197
|
*/
|
|
197
198
|
const char*
|
|
198
|
-
short_name (const char* name);
|
|
199
|
-
|
|
200
|
-
// TODO: update for the new namespaces.
|
|
199
|
+
short_name (const char* name) noexcept;
|
|
201
200
|
|
|
202
201
|
/**
|
|
203
202
|
* @brief Extract the type name from the `__PRETTY_FUNCTION__` macro.
|
|
@@ -226,6 +225,11 @@ namespace micro_os_plus::micro_test_plus
|
|
|
226
225
|
|
|
227
226
|
#endif // __cplusplus
|
|
228
227
|
|
|
228
|
+
// ============================================================================
|
|
229
|
+
// Templates & constexpr implementations.
|
|
230
|
+
|
|
231
|
+
#include "inlines/reflection-inlines.h"
|
|
232
|
+
|
|
229
233
|
// ----------------------------------------------------------------------------
|
|
230
234
|
|
|
231
235
|
#endif // MICRO_TEST_PLUS_REFLECTION_H_
|