@micro-os-plus/micro-test-plus 4.0.0 → 4.1.1
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 +95 -0
- package/CMakeLists.txt +74 -24
- package/README.md +3 -2
- package/include/micro-os-plus/micro-test-plus/README.md +6 -0
- package/include/micro-os-plus/micro-test-plus/deferred-reporter.h +29 -54
- package/include/micro-os-plus/micro-test-plus/detail.h +166 -705
- package/include/micro-os-plus/micro-test-plus/exceptions.h +5 -6
- package/include/micro-os-plus/micro-test-plus/expression-formatter.h +669 -0
- package/include/micro-os-plus/micro-test-plus/function-comparators.h +5 -0
- package/include/micro-os-plus/micro-test-plus/inlines/deferred-reporter-inlines.h +25 -30
- 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/expression-formatter-inlines.h +510 -0
- package/include/micro-os-plus/micro-test-plus/inlines/function-comparators-inlines.h +17 -76
- package/include/micro-os-plus/micro-test-plus/inlines/literals-inlines.h +47 -25
- package/include/micro-os-plus/micro-test-plus/inlines/math-inlines.h +7 -7
- 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 +4 -4
- package/include/micro-os-plus/micro-test-plus/inlines/reporter-inlines.h +53 -394
- package/include/micro-os-plus/micro-test-plus/inlines/runner-inlines.h +38 -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 +231 -45
- 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 +202 -0
- package/include/micro-os-plus/micro-test-plus/literals.h +8 -14
- package/include/micro-os-plus/micro-test-plus/math.h +5 -0
- package/include/micro-os-plus/micro-test-plus/operators.h +19 -169
- package/include/micro-os-plus/micro-test-plus/reflection.h +5 -12
- package/include/micro-os-plus/micro-test-plus/reporter-human.h +17 -11
- package/include/micro-os-plus/micro-test-plus/reporter-tap.h +14 -8
- package/include/micro-os-plus/micro-test-plus/reporter.h +101 -424
- package/include/micro-os-plus/micro-test-plus/runner-totals.h +162 -176
- package/include/micro-os-plus/micro-test-plus/runner.h +61 -42
- package/include/micro-os-plus/micro-test-plus/test.h +450 -506
- package/include/micro-os-plus/micro-test-plus/timings.h +259 -262
- package/include/micro-os-plus/micro-test-plus/type-traits.h +30 -52
- package/include/micro-os-plus/micro-test-plus/utility.h +5 -4
- package/include/micro-os-plus/micro-test-plus.h +33 -24
- package/meson.build +1 -0
- package/package.json +11 -3
- package/src/deferred-reporter.cpp +21 -2
- package/src/expression-formatter.cpp +289 -0
- package/src/reflection.cpp +3 -1
- package/src/reporter-human.cpp +31 -37
- package/src/reporter-tap.cpp +25 -35
- package/src/reporter.cpp +36 -231
- package/src/runner-totals.cpp +6 -3
- package/src/runner.cpp +131 -25
- package/src/test.cpp +120 -113
- package/src/timings.cpp +6 -5
- package/src/utility.cpp +1 -1
|
@@ -60,6 +60,7 @@
|
|
|
60
60
|
// ----------------------------------------------------------------------------
|
|
61
61
|
|
|
62
62
|
#include <cstdint>
|
|
63
|
+
|
|
63
64
|
#include "type-traits.h"
|
|
64
65
|
#include "math.h"
|
|
65
66
|
|
|
@@ -643,14 +644,8 @@ namespace micro_os_plus::micro_test_plus
|
|
|
643
644
|
* @brief Constructor for the deprecated strongly-typed wrapper.
|
|
644
645
|
*
|
|
645
646
|
* @param t The value to be wrapped and explicitly converted.
|
|
646
|
-
*
|
|
647
|
-
* @details
|
|
648
|
-
* Constructs an `_t` instance by forwarding the provided value to the base
|
|
649
|
-
* `type_traits::value<T>` wrapper.
|
|
650
647
|
*/
|
|
651
|
-
constexpr explicit _t (const T& t)
|
|
652
|
-
{
|
|
653
|
-
}
|
|
648
|
+
constexpr explicit _t (const T& t);
|
|
654
649
|
};
|
|
655
650
|
|
|
656
651
|
#if defined(__GNUC__)
|
|
@@ -885,14 +880,8 @@ namespace micro_os_plus::micro_test_plus
|
|
|
885
880
|
* @brief Constructor for the strongly-typed wrapper.
|
|
886
881
|
*
|
|
887
882
|
* @param t The value to be wrapped and explicitly converted.
|
|
888
|
-
*
|
|
889
|
-
* @details
|
|
890
|
-
* Constructs a `to_t` instance by forwarding the provided value to the
|
|
891
|
-
* base `type_traits::value<T>` wrapper.
|
|
892
883
|
*/
|
|
893
|
-
constexpr explicit to_t (const T& t)
|
|
894
|
-
{
|
|
895
|
-
}
|
|
884
|
+
constexpr explicit to_t (const T& t);
|
|
896
885
|
};
|
|
897
886
|
|
|
898
887
|
// --------------------------------------------------------------------------
|
|
@@ -906,6 +895,11 @@ namespace micro_os_plus::micro_test_plus
|
|
|
906
895
|
|
|
907
896
|
#endif // __cplusplus
|
|
908
897
|
|
|
898
|
+
// ============================================================================
|
|
899
|
+
// Templates & constexpr implementations.
|
|
900
|
+
|
|
901
|
+
#include "inlines/literals-inlines.h"
|
|
902
|
+
|
|
909
903
|
// ----------------------------------------------------------------------------
|
|
910
904
|
|
|
911
905
|
#endif // MICRO_TEST_PLUS_LITERALS_H_
|
|
@@ -213,6 +213,11 @@ namespace micro_os_plus::micro_test_plus
|
|
|
213
213
|
|
|
214
214
|
#endif // __cplusplus
|
|
215
215
|
|
|
216
|
+
// ============================================================================
|
|
217
|
+
// Templates & constexpr implementations.
|
|
218
|
+
|
|
219
|
+
#include "inlines/math-inlines.h"
|
|
220
|
+
|
|
216
221
|
// ----------------------------------------------------------------------------
|
|
217
222
|
|
|
218
223
|
#endif // MICRO_TEST_PLUS_MATH_H_
|
|
@@ -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
|
|
|
@@ -107,9 +107,6 @@ namespace micro_os_plus::micro_test_plus
|
|
|
107
107
|
*/
|
|
108
108
|
namespace operators
|
|
109
109
|
{
|
|
110
|
-
// In order to simplify things and use the return type `auto`,
|
|
111
|
-
// the definition must be included before any use.
|
|
112
|
-
|
|
113
110
|
/**
|
|
114
111
|
* @ingroup micro-test-plus-string-operators
|
|
115
112
|
* @brief Equality operator for `string_view` objects.
|
|
@@ -118,18 +115,9 @@ namespace micro_os_plus::micro_test_plus
|
|
|
118
115
|
* @param [in] rhs The right hand side `std::string_view` operand.
|
|
119
116
|
* @return A comparator object that evaluates to true if the string views
|
|
120
117
|
* are equal.
|
|
121
|
-
*
|
|
122
|
-
* @details
|
|
123
|
-
* This overload of the equality operator enables direct comparison of two
|
|
124
|
-
* `std::string_view` objects within the µTest++ framework. It constructs a
|
|
125
|
-
* comparator object that can be used in test expectations and assertions
|
|
126
|
-
* to verify that two string views are equal.
|
|
127
118
|
*/
|
|
128
119
|
[[nodiscard]] constexpr auto
|
|
129
|
-
operator== (std::string_view lhs, std::string_view rhs)
|
|
130
|
-
{
|
|
131
|
-
return detail::eq_{ lhs, rhs };
|
|
132
|
-
}
|
|
120
|
+
operator== (std::string_view lhs, std::string_view rhs);
|
|
133
121
|
|
|
134
122
|
/**
|
|
135
123
|
* @ingroup micro-test-plus-string-operators
|
|
@@ -139,18 +127,9 @@ namespace micro_os_plus::micro_test_plus
|
|
|
139
127
|
* @param [in] rhs The right hand side `std::string_view` operand.
|
|
140
128
|
* @return A comparator object that evaluates to true if the string views
|
|
141
129
|
* are not equal.
|
|
142
|
-
*
|
|
143
|
-
* @details
|
|
144
|
-
* This overload of the non-equality operator enables direct comparison of
|
|
145
|
-
* two `std::string_view` objects within the µTest++ framework. It
|
|
146
|
-
* constructs a comparator object that can be used in test expectations and
|
|
147
|
-
* assertions to verify that two string views are not equal.
|
|
148
130
|
*/
|
|
149
131
|
[[nodiscard]] constexpr auto
|
|
150
|
-
operator!= (std::string_view lhs, std::string_view rhs)
|
|
151
|
-
{
|
|
152
|
-
return detail::ne_{ lhs, rhs };
|
|
153
|
-
}
|
|
132
|
+
operator!= (std::string_view lhs, std::string_view rhs);
|
|
154
133
|
|
|
155
134
|
/**
|
|
156
135
|
* @ingroup micro-test-plus-container-operators
|
|
@@ -165,24 +144,12 @@ namespace micro_os_plus::micro_test_plus
|
|
|
165
144
|
* @param [in] rhs The right hand side container operand.
|
|
166
145
|
* @return A comparator object that evaluates to true if the containers are
|
|
167
146
|
* equal.
|
|
168
|
-
*
|
|
169
|
-
* @details
|
|
170
|
-
* This overload of the equality operator enables direct comparison of two
|
|
171
|
-
* container objects within the µTest++ framework. It constructs a
|
|
172
|
-
* comparator object that can be used in test expectations and assertions
|
|
173
|
-
* to verify that two containers are equal in content and order.
|
|
174
|
-
*
|
|
175
|
-
* The operator is enabled only for types recognised as containers by the
|
|
176
|
-
* framework's type traits.
|
|
177
147
|
*/
|
|
178
148
|
template <class Lhs_T, class Rhs_T>
|
|
179
149
|
requires (type_traits::container_like<Lhs_T>
|
|
180
150
|
and type_traits::container_like<Rhs_T>)
|
|
181
151
|
[[nodiscard]] constexpr auto
|
|
182
|
-
operator== (const Lhs_T& lhs, const Rhs_T& rhs)
|
|
183
|
-
{
|
|
184
|
-
return detail::eq_{ lhs, rhs };
|
|
185
|
-
}
|
|
152
|
+
operator== (const Lhs_T& lhs, const Rhs_T& rhs);
|
|
186
153
|
|
|
187
154
|
/**
|
|
188
155
|
* @ingroup micro-test-plus-container-operators
|
|
@@ -197,24 +164,12 @@ namespace micro_os_plus::micro_test_plus
|
|
|
197
164
|
* @param [in] rhs The right hand side container operand.
|
|
198
165
|
* @return A comparator object that evaluates to true if the containers are
|
|
199
166
|
* not equal.
|
|
200
|
-
*
|
|
201
|
-
* @details
|
|
202
|
-
* This overload of the non-equality operator enables direct comparison of
|
|
203
|
-
* two container objects within the µTest++ framework. It constructs a
|
|
204
|
-
* comparator object that can be used in test expectations and assertions
|
|
205
|
-
* to verify that two containers are not equal in content or order.
|
|
206
|
-
*
|
|
207
|
-
* The operator is enabled only for types recognised as containers by the
|
|
208
|
-
* framework's type traits.
|
|
209
167
|
*/
|
|
210
168
|
template <class Lhs_T, class Rhs_T>
|
|
211
169
|
requires (type_traits::container_like<Lhs_T>
|
|
212
170
|
and type_traits::container_like<Rhs_T>)
|
|
213
171
|
[[nodiscard]] constexpr auto
|
|
214
|
-
operator!= (const Lhs_T& lhs, const Rhs_T& rhs)
|
|
215
|
-
{
|
|
216
|
-
return detail::ne_{ lhs, rhs };
|
|
217
|
-
}
|
|
172
|
+
operator!= (const Lhs_T& lhs, const Rhs_T& rhs);
|
|
218
173
|
|
|
219
174
|
/**
|
|
220
175
|
* @ingroup micro-test-plus-operators
|
|
@@ -228,23 +183,11 @@ namespace micro_os_plus::micro_test_plus
|
|
|
228
183
|
* @param [in] rhs Right hand side operand.
|
|
229
184
|
* @return A comparator object that evaluates to true if the operands are
|
|
230
185
|
* equal.
|
|
231
|
-
*
|
|
232
|
-
* @details
|
|
233
|
-
* This overload of the equality operator enables comparison between two
|
|
234
|
-
* operands, where at least one is a local type derived from the local `op`
|
|
235
|
-
* base. It constructs a comparator object that can be used within the
|
|
236
|
-
* µTest++ framework to assert that the operands are equal. This operator
|
|
237
|
-
* is intended for use with the framework's strongly-typed constants,
|
|
238
|
-
* wrappers, or other custom types, ensuring type-safe and expressive test
|
|
239
|
-
* assertions.
|
|
240
186
|
*/
|
|
241
187
|
template <class Lhs_T, class Rhs_T>
|
|
242
188
|
requires type_traits::any_op<Lhs_T, Rhs_T>
|
|
243
189
|
[[nodiscard]] constexpr auto
|
|
244
|
-
operator== (const Lhs_T& lhs, const Rhs_T& rhs)
|
|
245
|
-
{
|
|
246
|
-
return detail::eq_{ lhs, rhs };
|
|
247
|
-
}
|
|
190
|
+
operator== (const Lhs_T& lhs, const Rhs_T& rhs);
|
|
248
191
|
|
|
249
192
|
/**
|
|
250
193
|
* @ingroup micro-test-plus-operators
|
|
@@ -258,23 +201,11 @@ namespace micro_os_plus::micro_test_plus
|
|
|
258
201
|
* @param [in] rhs Right hand side operand.
|
|
259
202
|
* @return A comparator object that evaluates to true if the operands are
|
|
260
203
|
* not equal.
|
|
261
|
-
*
|
|
262
|
-
* @details
|
|
263
|
-
* This overload of the non-equality operator enables comparison between
|
|
264
|
-
* two operands, where at least one is a local type derived from the local
|
|
265
|
-
* `op` base. It constructs a comparator object that can be used within the
|
|
266
|
-
* µTest++ framework to assert that the operands are not equal. This
|
|
267
|
-
* operator is intended for use with the framework's strongly-typed
|
|
268
|
-
* constants, wrappers, or other custom types, ensuring type-safe and
|
|
269
|
-
* expressive test assertions.
|
|
270
204
|
*/
|
|
271
205
|
template <class Lhs_T, class Rhs_T>
|
|
272
206
|
requires type_traits::any_op<Lhs_T, Rhs_T>
|
|
273
207
|
[[nodiscard]] constexpr auto
|
|
274
|
-
operator!= (const Lhs_T& lhs, const Rhs_T& rhs)
|
|
275
|
-
{
|
|
276
|
-
return detail::ne_{ lhs, rhs };
|
|
277
|
-
}
|
|
208
|
+
operator!= (const Lhs_T& lhs, const Rhs_T& rhs);
|
|
278
209
|
|
|
279
210
|
/**
|
|
280
211
|
* @ingroup micro-test-plus-operators
|
|
@@ -288,23 +219,11 @@ namespace micro_os_plus::micro_test_plus
|
|
|
288
219
|
* @param [in] rhs Right hand side operand.
|
|
289
220
|
* @return A comparator object that evaluates to true if the left hand side
|
|
290
221
|
* operand is greater than the right hand side operand.
|
|
291
|
-
*
|
|
292
|
-
* @details
|
|
293
|
-
* This overload of the greater than operator enables comparison between
|
|
294
|
-
* two operands, where at least one is a local type derived from the local
|
|
295
|
-
* `op` base. It constructs a comparator object that can be used within the
|
|
296
|
-
* µTest++ framework to assert that the left hand side operand is greater
|
|
297
|
-
* than the right hand side operand. This operator is intended for use with
|
|
298
|
-
* the framework's strongly-typed constants, wrappers, or other custom
|
|
299
|
-
* types, ensuring type-safe and expressive test assertions.
|
|
300
222
|
*/
|
|
301
223
|
template <class Lhs_T, class Rhs_T>
|
|
302
224
|
requires type_traits::any_op<Lhs_T, Rhs_T>
|
|
303
225
|
[[nodiscard]] constexpr auto
|
|
304
|
-
operator> (const Lhs_T& lhs, const Rhs_T& rhs)
|
|
305
|
-
{
|
|
306
|
-
return detail::gt_{ lhs, rhs };
|
|
307
|
-
}
|
|
226
|
+
operator> (const Lhs_T& lhs, const Rhs_T& rhs);
|
|
308
227
|
|
|
309
228
|
/**
|
|
310
229
|
* @ingroup micro-test-plus-operators
|
|
@@ -318,24 +237,11 @@ namespace micro_os_plus::micro_test_plus
|
|
|
318
237
|
* @param [in] rhs Right hand side operand.
|
|
319
238
|
* @return A comparator object that evaluates to true if the left hand side
|
|
320
239
|
* operand is greater than or equal to the right hand side operand.
|
|
321
|
-
*
|
|
322
|
-
* @details
|
|
323
|
-
* This overload of the greater than or equal operator enables comparison
|
|
324
|
-
* between two operands, where at least one is a local type derived from
|
|
325
|
-
* the local `op` base. It constructs a comparator object that can be used
|
|
326
|
-
* within the µTest++ framework to assert that the left hand side operand
|
|
327
|
-
* is greater than or equal to the right hand side operand. This operator
|
|
328
|
-
* is intended for use with the framework's strongly-typed constants,
|
|
329
|
-
* wrappers, or other custom types, ensuring type-safe and expressive test
|
|
330
|
-
* assertions.
|
|
331
240
|
*/
|
|
332
241
|
template <class Lhs_T, class Rhs_T>
|
|
333
242
|
requires type_traits::any_op<Lhs_T, Rhs_T>
|
|
334
243
|
[[nodiscard]] constexpr auto
|
|
335
|
-
operator>= (const Lhs_T& lhs, const Rhs_T& rhs)
|
|
336
|
-
{
|
|
337
|
-
return detail::ge_{ lhs, rhs };
|
|
338
|
-
}
|
|
244
|
+
operator>= (const Lhs_T& lhs, const Rhs_T& rhs);
|
|
339
245
|
|
|
340
246
|
/**
|
|
341
247
|
* @ingroup micro-test-plus-operators
|
|
@@ -349,23 +255,11 @@ namespace micro_os_plus::micro_test_plus
|
|
|
349
255
|
* @param [in] rhs Right hand side operand.
|
|
350
256
|
* @return A comparator object that evaluates to true if the left hand side
|
|
351
257
|
* operand is less than the right hand side operand.
|
|
352
|
-
*
|
|
353
|
-
* @details
|
|
354
|
-
* This overload of the less than operator enables comparison between two
|
|
355
|
-
* operands, where at least one is a local type derived from the local `op`
|
|
356
|
-
* base. It constructs a comparator object that can be used within the
|
|
357
|
-
* µTest++ framework to assert that the left hand side operand is less than
|
|
358
|
-
* the right hand side operand. This operator is intended for use with the
|
|
359
|
-
* framework's strongly-typed constants, wrappers, or other custom types,
|
|
360
|
-
* ensuring type-safe and expressive test assertions.
|
|
361
258
|
*/
|
|
362
259
|
template <class Lhs_T, class Rhs_T>
|
|
363
260
|
requires type_traits::any_op<Lhs_T, Rhs_T>
|
|
364
261
|
[[nodiscard]] constexpr auto
|
|
365
|
-
operator< (const Lhs_T& lhs, const Rhs_T& rhs)
|
|
366
|
-
{
|
|
367
|
-
return detail::lt_{ lhs, rhs };
|
|
368
|
-
}
|
|
262
|
+
operator< (const Lhs_T& lhs, const Rhs_T& rhs);
|
|
369
263
|
|
|
370
264
|
/**
|
|
371
265
|
* @ingroup micro-test-plus-operators
|
|
@@ -379,24 +273,11 @@ namespace micro_os_plus::micro_test_plus
|
|
|
379
273
|
* @param [in] rhs Right hand side operand.
|
|
380
274
|
* @return A comparator object that evaluates to true if the left hand side
|
|
381
275
|
* operand is less than or equal to the right hand side operand.
|
|
382
|
-
*
|
|
383
|
-
* @details
|
|
384
|
-
* This overload of the less than or equal operator enables comparison
|
|
385
|
-
* between two operands, where at least one is a local type derived from
|
|
386
|
-
* the local `op` base. It constructs a comparator object that can be used
|
|
387
|
-
* within the µTest++ framework to assert that the left hand side operand
|
|
388
|
-
* is less than or equal to the right hand side operand. This operator is
|
|
389
|
-
* intended for use with the framework's strongly-typed constants,
|
|
390
|
-
* wrappers, or other custom types, ensuring type-safe and expressive test
|
|
391
|
-
* assertions.
|
|
392
276
|
*/
|
|
393
277
|
template <class Lhs_T, class Rhs_T>
|
|
394
278
|
requires type_traits::any_op<Lhs_T, Rhs_T>
|
|
395
279
|
[[nodiscard]] constexpr auto
|
|
396
|
-
operator<= (const Lhs_T& lhs, const Rhs_T& rhs)
|
|
397
|
-
{
|
|
398
|
-
return detail::le_{ lhs, rhs };
|
|
399
|
-
}
|
|
280
|
+
operator<= (const Lhs_T& lhs, const Rhs_T& rhs);
|
|
400
281
|
|
|
401
282
|
/**
|
|
402
283
|
* @ingroup micro-test-plus-operators
|
|
@@ -410,23 +291,11 @@ namespace micro_os_plus::micro_test_plus
|
|
|
410
291
|
* @param [in] rhs Right hand side operand.
|
|
411
292
|
* @return A logical conjunction object that evaluates to true if both
|
|
412
293
|
* operands are true.
|
|
413
|
-
*
|
|
414
|
-
* @details
|
|
415
|
-
* This overload of the logical `&&` (and) operator enables conjunction
|
|
416
|
-
* between two operands, where at least one is a local type derived from
|
|
417
|
-
* the local `op` base. It constructs a logical conjunction object that can
|
|
418
|
-
* be used within the µTest++ framework to assert that both operands
|
|
419
|
-
* evaluate to true. This operator is intended for use with the framework's
|
|
420
|
-
* strongly-typed constants, wrappers, or other custom types, ensuring
|
|
421
|
-
* type-safe and expressive test assertions.
|
|
422
294
|
*/
|
|
423
295
|
template <class Lhs_T, class Rhs_T>
|
|
424
296
|
requires type_traits::any_op<Lhs_T, Rhs_T>
|
|
425
297
|
[[nodiscard]] constexpr auto
|
|
426
|
-
operator and (const Lhs_T& lhs, const Rhs_T& rhs)
|
|
427
|
-
{
|
|
428
|
-
return detail::and_{ lhs, rhs };
|
|
429
|
-
}
|
|
298
|
+
operator and (const Lhs_T& lhs, const Rhs_T& rhs);
|
|
430
299
|
|
|
431
300
|
/**
|
|
432
301
|
* @ingroup micro-test-plus-operators
|
|
@@ -440,23 +309,11 @@ namespace micro_os_plus::micro_test_plus
|
|
|
440
309
|
* @param [in] rhs Right hand side operand.
|
|
441
310
|
* @return A logical disjunction object that evaluates to true if at least
|
|
442
311
|
* one operand is true.
|
|
443
|
-
*
|
|
444
|
-
* @details
|
|
445
|
-
* This overload of the logical `||` (or) operator enables disjunction
|
|
446
|
-
* between two operands, where at least one is a local type derived from
|
|
447
|
-
* the local `op` base. It constructs a logical disjunction object that can
|
|
448
|
-
* be used within the µTest++ framework to assert that at least one operand
|
|
449
|
-
* evaluates to true. This operator is intended for use with the
|
|
450
|
-
* framework's strongly-typed constants, wrappers, or other custom types,
|
|
451
|
-
* ensuring type-safe and expressive test assertions.
|
|
452
312
|
*/
|
|
453
313
|
template <class Lhs_T, class Rhs_T>
|
|
454
314
|
requires type_traits::any_op<Lhs_T, Rhs_T>
|
|
455
315
|
[[nodiscard]] constexpr auto
|
|
456
|
-
operator or (const Lhs_T& lhs, const Rhs_T& rhs)
|
|
457
|
-
{
|
|
458
|
-
return detail::or_{ lhs, rhs };
|
|
459
|
-
}
|
|
316
|
+
operator or (const Lhs_T& lhs, const Rhs_T& rhs);
|
|
460
317
|
|
|
461
318
|
/**
|
|
462
319
|
* @ingroup micro-test-plus-operators
|
|
@@ -469,23 +326,11 @@ namespace micro_os_plus::micro_test_plus
|
|
|
469
326
|
* @param [in] t Operand to be logically negated.
|
|
470
327
|
* @return A logical negator object that evaluates to true if the operand
|
|
471
328
|
* is false.
|
|
472
|
-
*
|
|
473
|
-
* @details
|
|
474
|
-
* This overload of the logical `!` (not) operator enables logical negation
|
|
475
|
-
* of an operand, provided it is a local type derived from the local `op`
|
|
476
|
-
* base. It constructs a logical negator object that can be used within the
|
|
477
|
-
* µTest++ framework to assert that a given condition is false. This
|
|
478
|
-
* operator is intended for use with the framework's strongly-typed
|
|
479
|
-
* constants, wrappers, or other custom types, ensuring type-safe and
|
|
480
|
-
* expressive test assertions.
|
|
481
329
|
*/
|
|
482
330
|
template <class T>
|
|
483
331
|
requires type_traits::is_op<T>
|
|
484
332
|
[[nodiscard]] constexpr auto
|
|
485
|
-
operator not(const T& t)
|
|
486
|
-
{
|
|
487
|
-
return detail::not_{ t };
|
|
488
|
-
}
|
|
333
|
+
operator not(const T& t);
|
|
489
334
|
|
|
490
335
|
// ------------------------------------------------------------------------
|
|
491
336
|
} // namespace operators
|
|
@@ -501,6 +346,11 @@ namespace micro_os_plus::micro_test_plus
|
|
|
501
346
|
|
|
502
347
|
#endif // __cplusplus
|
|
503
348
|
|
|
349
|
+
// ============================================================================
|
|
350
|
+
// Templates & constexpr implementations.
|
|
351
|
+
|
|
352
|
+
#include "inlines/operators-inlines.h"
|
|
353
|
+
|
|
504
354
|
// ----------------------------------------------------------------------------
|
|
505
355
|
|
|
506
356
|
#endif // MICRO_TEST_PLUS_OPERATORS_H_
|
|
@@ -194,12 +194,6 @@ namespace micro_os_plus::micro_test_plus
|
|
|
194
194
|
*
|
|
195
195
|
* @param name The fully qualified name as a C-string.
|
|
196
196
|
* @return A pointer to the short name within the input string.
|
|
197
|
-
*
|
|
198
|
-
* @details
|
|
199
|
-
* Searches @p name for the last `/` separator and returns a pointer to
|
|
200
|
-
* the character immediately following it, effectively stripping the
|
|
201
|
-
* folder path. If no `/` is found, the original pointer is returned
|
|
202
|
-
* unchanged.
|
|
203
197
|
*/
|
|
204
198
|
const char*
|
|
205
199
|
short_name (const char* name) noexcept;
|
|
@@ -212,12 +206,6 @@ namespace micro_os_plus::micro_test_plus
|
|
|
212
206
|
* @par Parameters
|
|
213
207
|
* None.
|
|
214
208
|
* @return A `std::string_view` containing the extracted type name.
|
|
215
|
-
*
|
|
216
|
-
* @details
|
|
217
|
-
* Constructs a `std::string_view` from `__PRETTY_FUNCTION__` and
|
|
218
|
-
* parses out the portion that represents the template argument `T`,
|
|
219
|
-
* using compiler-specific prefix and suffix markers to locate the
|
|
220
|
-
* type-name substring at compile time.
|
|
221
209
|
*/
|
|
222
210
|
template <class T>
|
|
223
211
|
[[nodiscard]] constexpr auto
|
|
@@ -237,6 +225,11 @@ namespace micro_os_plus::micro_test_plus
|
|
|
237
225
|
|
|
238
226
|
#endif // __cplusplus
|
|
239
227
|
|
|
228
|
+
// ============================================================================
|
|
229
|
+
// Templates & constexpr implementations.
|
|
230
|
+
|
|
231
|
+
#include "inlines/reflection-inlines.h"
|
|
232
|
+
|
|
240
233
|
// ----------------------------------------------------------------------------
|
|
241
234
|
|
|
242
235
|
#endif // MICRO_TEST_PLUS_REFLECTION_H_
|
|
@@ -53,6 +53,7 @@
|
|
|
53
53
|
// ----------------------------------------------------------------------------
|
|
54
54
|
|
|
55
55
|
#include "reporter.h"
|
|
56
|
+
#include "reflection.h"
|
|
56
57
|
|
|
57
58
|
// ----------------------------------------------------------------------------
|
|
58
59
|
|
|
@@ -64,12 +65,18 @@
|
|
|
64
65
|
#endif
|
|
65
66
|
#endif
|
|
66
67
|
|
|
67
|
-
//
|
|
68
|
+
// ============================================================================
|
|
68
69
|
|
|
69
70
|
namespace micro_os_plus::micro_test_plus
|
|
70
71
|
{
|
|
71
72
|
// --------------------------------------------------------------------------
|
|
72
73
|
|
|
74
|
+
class runner;
|
|
75
|
+
class suite;
|
|
76
|
+
class subtest;
|
|
77
|
+
|
|
78
|
+
// ==========================================================================
|
|
79
|
+
|
|
73
80
|
/**
|
|
74
81
|
* @brief Human (standard output) implementation of `reporter`.
|
|
75
82
|
*
|
|
@@ -97,9 +104,6 @@ namespace micro_os_plus::micro_test_plus
|
|
|
97
104
|
/**
|
|
98
105
|
* @brief Constructor for the reporter_human class.
|
|
99
106
|
*
|
|
100
|
-
* @details
|
|
101
|
-
* The rule of five is enforced to prevent accidental copying or moving.
|
|
102
|
-
*
|
|
103
107
|
* @param argvs Owning pointer to the command-line arguments vector;
|
|
104
108
|
* the reporter takes ownership via move.
|
|
105
109
|
*/
|
|
@@ -119,13 +123,15 @@ namespace micro_os_plus::micro_test_plus
|
|
|
119
123
|
* @brief Deleted copy assignment operator to prevent copying.
|
|
120
124
|
*/
|
|
121
125
|
reporter_human&
|
|
122
|
-
operator= (const reporter_human&)
|
|
126
|
+
operator= (const reporter_human&)
|
|
127
|
+
= delete;
|
|
123
128
|
|
|
124
129
|
/**
|
|
125
130
|
* @brief Deleted move assignment operator to prevent moving.
|
|
126
131
|
*/
|
|
127
132
|
reporter_human&
|
|
128
|
-
operator= (reporter_human&&)
|
|
133
|
+
operator= (reporter_human&&)
|
|
134
|
+
= delete;
|
|
129
135
|
|
|
130
136
|
/**
|
|
131
137
|
* @brief Destructor for the reporter_human class.
|
|
@@ -141,7 +147,7 @@ namespace micro_os_plus::micro_test_plus
|
|
|
141
147
|
* @return Reference to the current reporter instance.
|
|
142
148
|
*/
|
|
143
149
|
reporter_human&
|
|
144
|
-
operator<< (indent_t m);
|
|
150
|
+
operator<< (detail::indent_t m);
|
|
145
151
|
|
|
146
152
|
// Bring base class operator<< overloads into scope to prevent name hiding.
|
|
147
153
|
using reporter::operator<<;
|
|
@@ -149,7 +155,7 @@ namespace micro_os_plus::micro_test_plus
|
|
|
149
155
|
// ------------------------------------------------------------------------
|
|
150
156
|
|
|
151
157
|
/**
|
|
152
|
-
* @brief Mark the beginning of a test
|
|
158
|
+
* @brief Mark the beginning of a test session.
|
|
153
159
|
*
|
|
154
160
|
* @param runner Reference to the test runner.
|
|
155
161
|
* @par Returns
|
|
@@ -159,7 +165,7 @@ namespace micro_os_plus::micro_test_plus
|
|
|
159
165
|
begin_session (runner& runner) override;
|
|
160
166
|
|
|
161
167
|
/**
|
|
162
|
-
* @brief Mark the end of a test
|
|
168
|
+
* @brief Mark the end of a test session.
|
|
163
169
|
*
|
|
164
170
|
* @param runner Reference to the test runner.
|
|
165
171
|
* @par Returns
|
|
@@ -245,7 +251,7 @@ namespace micro_os_plus::micro_test_plus
|
|
|
245
251
|
* @brief Outputs the prefix for a failing condition.
|
|
246
252
|
*
|
|
247
253
|
* @param message The message to display.
|
|
248
|
-
* @param
|
|
254
|
+
* @param has_expression Whether the failure is associated with an
|
|
249
255
|
* expression.
|
|
250
256
|
* @param location The source location of the failure.
|
|
251
257
|
* @param subtest The subtest that owns this check.
|
|
@@ -253,7 +259,7 @@ namespace micro_os_plus::micro_test_plus
|
|
|
253
259
|
* Nothing.
|
|
254
260
|
*/
|
|
255
261
|
void
|
|
256
|
-
output_fail_prefix_ (std::string& message, const bool
|
|
262
|
+
output_fail_prefix_ (std::string& message, const bool has_expression,
|
|
257
263
|
const reflection::source_location& location,
|
|
258
264
|
subtest& subtest) override;
|
|
259
265
|
|
|
@@ -46,6 +46,7 @@
|
|
|
46
46
|
// ----------------------------------------------------------------------------
|
|
47
47
|
|
|
48
48
|
#include "reporter.h"
|
|
49
|
+
#include "reflection.h"
|
|
49
50
|
|
|
50
51
|
// ----------------------------------------------------------------------------
|
|
51
52
|
|
|
@@ -63,6 +64,12 @@ namespace micro_os_plus::micro_test_plus
|
|
|
63
64
|
{
|
|
64
65
|
// --------------------------------------------------------------------------
|
|
65
66
|
|
|
67
|
+
class runner;
|
|
68
|
+
class suite;
|
|
69
|
+
class subtest;
|
|
70
|
+
|
|
71
|
+
// ==========================================================================
|
|
72
|
+
|
|
66
73
|
/**
|
|
67
74
|
* @brief TAP (Test Anything Protocol) implementation of `reporter`.
|
|
68
75
|
*
|
|
@@ -89,9 +96,6 @@ namespace micro_os_plus::micro_test_plus
|
|
|
89
96
|
/**
|
|
90
97
|
* @brief Constructor for the reporter_tap class.
|
|
91
98
|
*
|
|
92
|
-
* @details
|
|
93
|
-
* The rule of five is enforced to prevent accidental copying or moving.
|
|
94
|
-
*
|
|
95
99
|
* @param argvs Owning pointer to the command-line arguments vector;
|
|
96
100
|
* the reporter takes ownership via move.
|
|
97
101
|
*/
|
|
@@ -111,13 +115,15 @@ namespace micro_os_plus::micro_test_plus
|
|
|
111
115
|
* @brief Deleted copy assignment operator to prevent copying.
|
|
112
116
|
*/
|
|
113
117
|
reporter_tap&
|
|
114
|
-
operator= (const reporter_tap&)
|
|
118
|
+
operator= (const reporter_tap&)
|
|
119
|
+
= delete;
|
|
115
120
|
|
|
116
121
|
/**
|
|
117
122
|
* @brief Deleted move assignment operator to prevent moving.
|
|
118
123
|
*/
|
|
119
124
|
reporter_tap&
|
|
120
|
-
operator= (reporter_tap&&)
|
|
125
|
+
operator= (reporter_tap&&)
|
|
126
|
+
= delete;
|
|
121
127
|
|
|
122
128
|
/**
|
|
123
129
|
* @brief Destructor for the reporter_tap class.
|
|
@@ -133,7 +139,7 @@ namespace micro_os_plus::micro_test_plus
|
|
|
133
139
|
* @return Reference to the current reporter instance.
|
|
134
140
|
*/
|
|
135
141
|
reporter_tap&
|
|
136
|
-
operator<< (indent_t m);
|
|
142
|
+
operator<< (detail::indent_t m);
|
|
137
143
|
|
|
138
144
|
// Bring base class operator<< overloads into scope to prevent name hiding.
|
|
139
145
|
using reporter::operator<<;
|
|
@@ -237,7 +243,7 @@ namespace micro_os_plus::micro_test_plus
|
|
|
237
243
|
* @brief Outputs the prefix for a failing condition.
|
|
238
244
|
*
|
|
239
245
|
* @param message The message to display.
|
|
240
|
-
* @param
|
|
246
|
+
* @param has_expression Whether the failure is associated with an
|
|
241
247
|
* expression.
|
|
242
248
|
* @param location The source location of the failure.
|
|
243
249
|
* @param subtest The subtest that owns this check.
|
|
@@ -245,7 +251,7 @@ namespace micro_os_plus::micro_test_plus
|
|
|
245
251
|
* Nothing.
|
|
246
252
|
*/
|
|
247
253
|
void
|
|
248
|
-
output_fail_prefix_ (std::string& message, const bool
|
|
254
|
+
output_fail_prefix_ (std::string& message, const bool has_expression,
|
|
249
255
|
const reflection::source_location& location,
|
|
250
256
|
subtest& subtest) override;
|
|
251
257
|
|