@micro-os-plus/micro-test-plus 4.0.0 → 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 +82 -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 +231 -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 +19 -67
- 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
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
#endif
|
|
65
65
|
#endif
|
|
66
66
|
|
|
67
|
-
//
|
|
67
|
+
// ============================================================================
|
|
68
68
|
|
|
69
69
|
namespace micro_os_plus::micro_test_plus
|
|
70
70
|
{
|
|
@@ -79,7 +79,7 @@ namespace micro_os_plus::micro_test_plus
|
|
|
79
79
|
* the actual and expected values.
|
|
80
80
|
*/
|
|
81
81
|
template <class Lhs_T, class Rhs_T>
|
|
82
|
-
|
|
82
|
+
constexpr auto
|
|
83
83
|
eq (const Lhs_T& lhs, const Rhs_T& rhs)
|
|
84
84
|
{
|
|
85
85
|
return detail::eq_<Lhs_T, Rhs_T>{ lhs, rhs };
|
|
@@ -94,7 +94,7 @@ namespace micro_os_plus::micro_test_plus
|
|
|
94
94
|
* addresses of objects or resources.
|
|
95
95
|
*/
|
|
96
96
|
template <class Lhs_T, class Rhs_T>
|
|
97
|
-
|
|
97
|
+
constexpr auto
|
|
98
98
|
eq (Lhs_T* lhs, Rhs_T* rhs)
|
|
99
99
|
{
|
|
100
100
|
return detail::eq_<Lhs_T*, Rhs_T*>{ lhs, rhs };
|
|
@@ -109,7 +109,7 @@ namespace micro_os_plus::micro_test_plus
|
|
|
109
109
|
* actual and expected values.
|
|
110
110
|
*/
|
|
111
111
|
template <class Lhs_T, class Rhs_T>
|
|
112
|
-
|
|
112
|
+
constexpr auto
|
|
113
113
|
ne (const Lhs_T& lhs, const Rhs_T& rhs)
|
|
114
114
|
{
|
|
115
115
|
return detail::ne_<Lhs_T, Rhs_T>{ lhs, rhs };
|
|
@@ -124,7 +124,7 @@ namespace micro_os_plus::micro_test_plus
|
|
|
124
124
|
* compare the addresses of objects or resources.
|
|
125
125
|
*/
|
|
126
126
|
template <class Lhs_T, class Rhs_T>
|
|
127
|
-
|
|
127
|
+
constexpr auto
|
|
128
128
|
ne (Lhs_T* lhs, Rhs_T* rhs)
|
|
129
129
|
{
|
|
130
130
|
return detail::ne_<Lhs_T*, Rhs_T*>{ lhs, rhs };
|
|
@@ -139,7 +139,7 @@ namespace micro_os_plus::micro_test_plus
|
|
|
139
139
|
* the actual and expected values.
|
|
140
140
|
*/
|
|
141
141
|
template <class Lhs_T, class Rhs_T>
|
|
142
|
-
|
|
142
|
+
constexpr auto
|
|
143
143
|
gt (const Lhs_T& lhs, const Rhs_T& rhs)
|
|
144
144
|
{
|
|
145
145
|
return detail::gt_<Lhs_T, Rhs_T>{ lhs, rhs };
|
|
@@ -154,7 +154,7 @@ namespace micro_os_plus::micro_test_plus
|
|
|
154
154
|
* assertions to compare the addresses of objects or resources.
|
|
155
155
|
*/
|
|
156
156
|
template <class Lhs_T, class Rhs_T>
|
|
157
|
-
|
|
157
|
+
constexpr auto
|
|
158
158
|
gt (Lhs_T* lhs, Rhs_T* rhs)
|
|
159
159
|
{
|
|
160
160
|
return detail::gt_<Lhs_T*, Rhs_T*>{ lhs, rhs };
|
|
@@ -169,7 +169,7 @@ namespace micro_os_plus::micro_test_plus
|
|
|
169
169
|
* and assertions to compare the actual and expected values.
|
|
170
170
|
*/
|
|
171
171
|
template <class Lhs_T, class Rhs_T>
|
|
172
|
-
|
|
172
|
+
constexpr auto
|
|
173
173
|
ge (const Lhs_T& lhs, const Rhs_T& rhs)
|
|
174
174
|
{
|
|
175
175
|
return detail::ge_<Lhs_T, Rhs_T>{ lhs, rhs };
|
|
@@ -185,7 +185,7 @@ namespace micro_os_plus::micro_test_plus
|
|
|
185
185
|
* resources.
|
|
186
186
|
*/
|
|
187
187
|
template <class Lhs_T, class Rhs_T>
|
|
188
|
-
|
|
188
|
+
constexpr auto
|
|
189
189
|
ge (Lhs_T* lhs, Rhs_T* rhs)
|
|
190
190
|
{
|
|
191
191
|
return detail::ge_<Lhs_T*, Rhs_T*>{ lhs, rhs };
|
|
@@ -200,7 +200,7 @@ namespace micro_os_plus::micro_test_plus
|
|
|
200
200
|
* the actual and expected values.
|
|
201
201
|
*/
|
|
202
202
|
template <class Lhs_T, class Rhs_T>
|
|
203
|
-
|
|
203
|
+
constexpr auto
|
|
204
204
|
lt (const Lhs_T& lhs, const Rhs_T& rhs)
|
|
205
205
|
{
|
|
206
206
|
return detail::lt_<Lhs_T, Rhs_T>{ lhs, rhs };
|
|
@@ -215,7 +215,7 @@ namespace micro_os_plus::micro_test_plus
|
|
|
215
215
|
* compare the addresses of objects or resources.
|
|
216
216
|
*/
|
|
217
217
|
template <class Lhs_T, class Rhs_T>
|
|
218
|
-
|
|
218
|
+
constexpr auto
|
|
219
219
|
lt (Lhs_T* lhs, Rhs_T* rhs)
|
|
220
220
|
{
|
|
221
221
|
return detail::lt_<Lhs_T*, Rhs_T*>{ lhs, rhs };
|
|
@@ -230,7 +230,7 @@ namespace micro_os_plus::micro_test_plus
|
|
|
230
230
|
* assertions to compare the actual and expected values.
|
|
231
231
|
*/
|
|
232
232
|
template <class Lhs_T, class Rhs_T>
|
|
233
|
-
|
|
233
|
+
constexpr auto
|
|
234
234
|
le (const Lhs_T& lhs, const Rhs_T& rhs)
|
|
235
235
|
{
|
|
236
236
|
return detail::le_<Lhs_T, Rhs_T>{ lhs, rhs };
|
|
@@ -246,7 +246,7 @@ namespace micro_os_plus::micro_test_plus
|
|
|
246
246
|
* resources.
|
|
247
247
|
*/
|
|
248
248
|
template <class Lhs_T, class Rhs_T>
|
|
249
|
-
|
|
249
|
+
constexpr auto
|
|
250
250
|
le (Lhs_T* lhs, Rhs_T* rhs)
|
|
251
251
|
{
|
|
252
252
|
return detail::le_<Lhs_T*, Rhs_T*>{ lhs, rhs };
|
|
@@ -267,7 +267,7 @@ namespace micro_os_plus::micro_test_plus
|
|
|
267
267
|
* from the standard logical not operator.
|
|
268
268
|
*/
|
|
269
269
|
template <class Expr_T>
|
|
270
|
-
|
|
270
|
+
constexpr auto
|
|
271
271
|
_not (const Expr_T& expr)
|
|
272
272
|
{
|
|
273
273
|
return detail::not_<Expr_T>{ expr };
|
|
@@ -285,7 +285,7 @@ namespace micro_os_plus::micro_test_plus
|
|
|
285
285
|
* from the standard logical and operator.
|
|
286
286
|
*/
|
|
287
287
|
template <class Lhs_T, class Rhs_T>
|
|
288
|
-
|
|
288
|
+
constexpr auto
|
|
289
289
|
_and (const Lhs_T& lhs, const Rhs_T& rhs)
|
|
290
290
|
{
|
|
291
291
|
return detail::and_<Lhs_T, Rhs_T>{ lhs, rhs };
|
|
@@ -303,71 +303,12 @@ namespace micro_os_plus::micro_test_plus
|
|
|
303
303
|
* from the standard logical or operator.
|
|
304
304
|
*/
|
|
305
305
|
template <class Lhs_T, class Rhs_T>
|
|
306
|
-
|
|
306
|
+
constexpr auto
|
|
307
307
|
_or (const Lhs_T& lhs, const Rhs_T& rhs)
|
|
308
308
|
{
|
|
309
309
|
return detail::or_<Lhs_T, Rhs_T>{ lhs, rhs };
|
|
310
310
|
}
|
|
311
311
|
|
|
312
|
-
// --------------------------------------------------------------------------
|
|
313
|
-
// Exceptions related comparators.
|
|
314
|
-
|
|
315
|
-
#if defined(__cpp_exceptions)
|
|
316
|
-
|
|
317
|
-
/**
|
|
318
|
-
* @details
|
|
319
|
-
* The `throws` function template verifies whether invoking the provided
|
|
320
|
-
* callable object results in the throwing of a specific exception type
|
|
321
|
-
* within the µTest++ framework. This is useful for testing error handling
|
|
322
|
-
* and exception safety in code under test.
|
|
323
|
-
*
|
|
324
|
-
* The function returns an output stream, allowing optional messages to be
|
|
325
|
-
* appended to the test report for diagnostic purposes.
|
|
326
|
-
*/
|
|
327
|
-
template <class Exception_T, class Callable_T>
|
|
328
|
-
[[nodiscard]] constexpr auto
|
|
329
|
-
throws (const Callable_T& func)
|
|
330
|
-
{
|
|
331
|
-
return detail::throws_<Callable_T, Exception_T>{ func };
|
|
332
|
-
}
|
|
333
|
-
|
|
334
|
-
/**
|
|
335
|
-
* @details
|
|
336
|
-
* The `throws` function template verifies whether invoking the provided
|
|
337
|
-
* callable object results in the throwing of any exception within the
|
|
338
|
-
* µTest++ framework. This is useful for testing general exception safety and
|
|
339
|
-
* ensuring that code under test properly signals error conditions.
|
|
340
|
-
*
|
|
341
|
-
* The function returns an output stream, allowing optional messages to be
|
|
342
|
-
* appended to the test report for diagnostic purposes.
|
|
343
|
-
*/
|
|
344
|
-
template <class Callable_T>
|
|
345
|
-
[[nodiscard]] constexpr auto
|
|
346
|
-
throws (const Callable_T& func)
|
|
347
|
-
{
|
|
348
|
-
return detail::throws_<Callable_T>{ func };
|
|
349
|
-
}
|
|
350
|
-
|
|
351
|
-
/**
|
|
352
|
-
* @details
|
|
353
|
-
* The `nothrow` function template verifies whether invoking the provided
|
|
354
|
-
* callable object does not result in the throwing of any exception within
|
|
355
|
-
* the µTest++ framework. This is useful for testing exception safety and
|
|
356
|
-
* ensuring that code under test does not unexpectedly signal error
|
|
357
|
-
* conditions.
|
|
358
|
-
*
|
|
359
|
-
* The function returns an output stream, allowing optional messages to be
|
|
360
|
-
* appended to the test report for diagnostic purposes.
|
|
361
|
-
*/
|
|
362
|
-
template <class Callable_T>
|
|
363
|
-
[[nodiscard]] constexpr auto
|
|
364
|
-
nothrow (const Callable_T& func)
|
|
365
|
-
{
|
|
366
|
-
return detail::nothrow_<Callable_T>{ func };
|
|
367
|
-
}
|
|
368
|
-
|
|
369
|
-
#endif // defined(__cpp_exceptions)
|
|
370
|
-
|
|
371
312
|
// --------------------------------------------------------------------------
|
|
372
313
|
// Utility functions.
|
|
373
314
|
|
|
@@ -380,7 +321,7 @@ namespace micro_os_plus::micro_test_plus
|
|
|
380
321
|
* testing scenarios where controlled mutation of test data is required.
|
|
381
322
|
*/
|
|
382
323
|
template <class T>
|
|
383
|
-
|
|
324
|
+
constexpr auto
|
|
384
325
|
mut (const T& t) noexcept -> T&
|
|
385
326
|
{
|
|
386
327
|
return const_cast<T&> (t);
|
|
@@ -90,7 +90,7 @@ namespace micro_os_plus::micro_test_plus
|
|
|
90
90
|
* and reporting mechanisms.
|
|
91
91
|
*/
|
|
92
92
|
template <char... Cs>
|
|
93
|
-
|
|
93
|
+
constexpr auto
|
|
94
94
|
operator""_i ()
|
|
95
95
|
{
|
|
96
96
|
return type_traits::integral_constant<math::num<int, Cs...> ()>{};
|
|
@@ -108,7 +108,7 @@ namespace micro_os_plus::micro_test_plus
|
|
|
108
108
|
* and reporting mechanisms.
|
|
109
109
|
*/
|
|
110
110
|
template <char... Cs>
|
|
111
|
-
|
|
111
|
+
constexpr auto
|
|
112
112
|
operator""_s ()
|
|
113
113
|
{
|
|
114
114
|
return type_traits::integral_constant<math::num<short, Cs...> ()>{};
|
|
@@ -126,7 +126,7 @@ namespace micro_os_plus::micro_test_plus
|
|
|
126
126
|
* comparators and reporting mechanisms.
|
|
127
127
|
*/
|
|
128
128
|
template <char... Cs>
|
|
129
|
-
|
|
129
|
+
constexpr auto
|
|
130
130
|
operator""_c ()
|
|
131
131
|
{
|
|
132
132
|
return type_traits::integral_constant<math::num<char, Cs...> ()>{};
|
|
@@ -144,7 +144,7 @@ namespace micro_os_plus::micro_test_plus
|
|
|
144
144
|
* and reporting mechanisms.
|
|
145
145
|
*/
|
|
146
146
|
template <char... Cs>
|
|
147
|
-
|
|
147
|
+
constexpr auto
|
|
148
148
|
operator""_sc ()
|
|
149
149
|
{
|
|
150
150
|
return type_traits::integral_constant<
|
|
@@ -163,7 +163,7 @@ namespace micro_os_plus::micro_test_plus
|
|
|
163
163
|
* and reporting mechanisms.
|
|
164
164
|
*/
|
|
165
165
|
template <char... Cs>
|
|
166
|
-
|
|
166
|
+
constexpr auto
|
|
167
167
|
operator""_l ()
|
|
168
168
|
{
|
|
169
169
|
return type_traits::integral_constant<math::num<long, Cs...> ()>{};
|
|
@@ -181,7 +181,7 @@ namespace micro_os_plus::micro_test_plus
|
|
|
181
181
|
* and reporting mechanisms.
|
|
182
182
|
*/
|
|
183
183
|
template <char... Cs>
|
|
184
|
-
|
|
184
|
+
constexpr auto
|
|
185
185
|
operator""_ll ()
|
|
186
186
|
{
|
|
187
187
|
return type_traits::integral_constant<math::num<long long, Cs...> ()>{};
|
|
@@ -199,7 +199,7 @@ namespace micro_os_plus::micro_test_plus
|
|
|
199
199
|
* and reporting mechanisms.
|
|
200
200
|
*/
|
|
201
201
|
template <char... Cs>
|
|
202
|
-
|
|
202
|
+
constexpr auto
|
|
203
203
|
operator""_u ()
|
|
204
204
|
{
|
|
205
205
|
return type_traits::integral_constant<math::num<unsigned, Cs...> ()>{};
|
|
@@ -217,7 +217,7 @@ namespace micro_os_plus::micro_test_plus
|
|
|
217
217
|
* and reporting mechanisms.
|
|
218
218
|
*/
|
|
219
219
|
template <char... Cs>
|
|
220
|
-
|
|
220
|
+
constexpr auto
|
|
221
221
|
operator""_uc ()
|
|
222
222
|
{
|
|
223
223
|
return type_traits::integral_constant<
|
|
@@ -236,7 +236,7 @@ namespace micro_os_plus::micro_test_plus
|
|
|
236
236
|
* and reporting mechanisms.
|
|
237
237
|
*/
|
|
238
238
|
template <char... Cs>
|
|
239
|
-
|
|
239
|
+
constexpr auto
|
|
240
240
|
operator""_us ()
|
|
241
241
|
{
|
|
242
242
|
return type_traits::integral_constant<
|
|
@@ -255,7 +255,7 @@ namespace micro_os_plus::micro_test_plus
|
|
|
255
255
|
* and reporting mechanisms.
|
|
256
256
|
*/
|
|
257
257
|
template <char... Cs>
|
|
258
|
-
|
|
258
|
+
constexpr auto
|
|
259
259
|
operator""_ul ()
|
|
260
260
|
{
|
|
261
261
|
return type_traits::integral_constant<
|
|
@@ -274,7 +274,7 @@ namespace micro_os_plus::micro_test_plus
|
|
|
274
274
|
* comparators and reporting mechanisms.
|
|
275
275
|
*/
|
|
276
276
|
template <char... Cs>
|
|
277
|
-
|
|
277
|
+
constexpr auto
|
|
278
278
|
operator""_ull ()
|
|
279
279
|
{
|
|
280
280
|
return type_traits::integral_constant<
|
|
@@ -293,7 +293,7 @@ namespace micro_os_plus::micro_test_plus
|
|
|
293
293
|
* and reporting mechanisms.
|
|
294
294
|
*/
|
|
295
295
|
template <char... Cs>
|
|
296
|
-
|
|
296
|
+
constexpr auto
|
|
297
297
|
operator""_i8 ()
|
|
298
298
|
{
|
|
299
299
|
return type_traits::integral_constant<
|
|
@@ -312,7 +312,7 @@ namespace micro_os_plus::micro_test_plus
|
|
|
312
312
|
* comparators and reporting mechanisms.
|
|
313
313
|
*/
|
|
314
314
|
template <char... Cs>
|
|
315
|
-
|
|
315
|
+
constexpr auto
|
|
316
316
|
operator""_i16 ()
|
|
317
317
|
{
|
|
318
318
|
return type_traits::integral_constant<
|
|
@@ -331,7 +331,7 @@ namespace micro_os_plus::micro_test_plus
|
|
|
331
331
|
* comparators and reporting mechanisms.
|
|
332
332
|
*/
|
|
333
333
|
template <char... Cs>
|
|
334
|
-
|
|
334
|
+
constexpr auto
|
|
335
335
|
operator""_i32 ()
|
|
336
336
|
{
|
|
337
337
|
return type_traits::integral_constant<
|
|
@@ -350,7 +350,7 @@ namespace micro_os_plus::micro_test_plus
|
|
|
350
350
|
* seamlessly with the µTest++ comparators and reporting mechanisms.
|
|
351
351
|
*/
|
|
352
352
|
template <char... Cs>
|
|
353
|
-
|
|
353
|
+
constexpr auto
|
|
354
354
|
operator""_i64 ()
|
|
355
355
|
{
|
|
356
356
|
return type_traits::integral_constant<
|
|
@@ -369,7 +369,7 @@ namespace micro_os_plus::micro_test_plus
|
|
|
369
369
|
* and reporting mechanisms.
|
|
370
370
|
*/
|
|
371
371
|
template <char... Cs>
|
|
372
|
-
|
|
372
|
+
constexpr auto
|
|
373
373
|
operator""_u8 ()
|
|
374
374
|
{
|
|
375
375
|
return type_traits::integral_constant<
|
|
@@ -388,7 +388,7 @@ namespace micro_os_plus::micro_test_plus
|
|
|
388
388
|
* comparators and reporting mechanisms.
|
|
389
389
|
*/
|
|
390
390
|
template <char... Cs>
|
|
391
|
-
|
|
391
|
+
constexpr auto
|
|
392
392
|
operator""_u16 ()
|
|
393
393
|
{
|
|
394
394
|
return type_traits::integral_constant<
|
|
@@ -407,7 +407,7 @@ namespace micro_os_plus::micro_test_plus
|
|
|
407
407
|
* comparators and reporting mechanisms.
|
|
408
408
|
*/
|
|
409
409
|
template <char... Cs>
|
|
410
|
-
|
|
410
|
+
constexpr auto
|
|
411
411
|
operator""_u32 ()
|
|
412
412
|
{
|
|
413
413
|
return type_traits::integral_constant<
|
|
@@ -426,7 +426,7 @@ namespace micro_os_plus::micro_test_plus
|
|
|
426
426
|
* seamlessly with the µTest++ comparators and reporting mechanisms.
|
|
427
427
|
*/
|
|
428
428
|
template <char... Cs>
|
|
429
|
-
|
|
429
|
+
constexpr auto
|
|
430
430
|
operator""_u64 ()
|
|
431
431
|
{
|
|
432
432
|
return type_traits::integral_constant<
|
|
@@ -445,7 +445,7 @@ namespace micro_os_plus::micro_test_plus
|
|
|
445
445
|
* and reporting mechanisms.
|
|
446
446
|
*/
|
|
447
447
|
template <char... Cs>
|
|
448
|
-
|
|
448
|
+
constexpr auto
|
|
449
449
|
operator""_f ()
|
|
450
450
|
{
|
|
451
451
|
return type_traits::floating_point_constant<
|
|
@@ -466,7 +466,7 @@ namespace micro_os_plus::micro_test_plus
|
|
|
466
466
|
* and reporting mechanisms.
|
|
467
467
|
*/
|
|
468
468
|
template <char... Cs>
|
|
469
|
-
|
|
469
|
+
constexpr auto
|
|
470
470
|
operator""_d ()
|
|
471
471
|
{
|
|
472
472
|
return type_traits::floating_point_constant<
|
|
@@ -487,7 +487,7 @@ namespace micro_os_plus::micro_test_plus
|
|
|
487
487
|
* comparators and reporting mechanisms.
|
|
488
488
|
*/
|
|
489
489
|
template <char... Cs>
|
|
490
|
-
|
|
490
|
+
constexpr auto
|
|
491
491
|
operator""_ld ()
|
|
492
492
|
{
|
|
493
493
|
return type_traits::floating_point_constant<
|
|
@@ -540,7 +540,7 @@ namespace micro_os_plus::micro_test_plus
|
|
|
540
540
|
* Always returns `true`, representing the presence of the named
|
|
541
541
|
* literal in a test context.
|
|
542
542
|
*/
|
|
543
|
-
|
|
543
|
+
constexpr
|
|
544
544
|
operator value_type () const
|
|
545
545
|
{
|
|
546
546
|
return true;
|
|
@@ -555,7 +555,7 @@ namespace micro_os_plus::micro_test_plus
|
|
|
555
555
|
* Always returns `true`, indicating that any two named literals are
|
|
556
556
|
* considered equal in this context.
|
|
557
557
|
*/
|
|
558
|
-
|
|
558
|
+
constexpr auto
|
|
559
559
|
operator== (const named&) const
|
|
560
560
|
{
|
|
561
561
|
return true;
|
|
@@ -570,7 +570,7 @@ namespace micro_os_plus::micro_test_plus
|
|
|
570
570
|
* Returns the value of the boolean operand, allowing the named literal
|
|
571
571
|
* to be compared directly with a boolean.
|
|
572
572
|
*/
|
|
573
|
-
|
|
573
|
+
constexpr auto
|
|
574
574
|
operator== (const bool other) const
|
|
575
575
|
{
|
|
576
576
|
return other;
|
|
@@ -583,6 +583,28 @@ namespace micro_os_plus::micro_test_plus
|
|
|
583
583
|
// ------------------------------------------------------------------------
|
|
584
584
|
} // namespace literals
|
|
585
585
|
|
|
586
|
+
// ==========================================================================
|
|
587
|
+
|
|
588
|
+
/**
|
|
589
|
+
* @details
|
|
590
|
+
* Constructs an `_t` instance by forwarding the provided value to the base
|
|
591
|
+
* `type_traits::value<T>` wrapper.
|
|
592
|
+
*/
|
|
593
|
+
template <class T>
|
|
594
|
+
constexpr _t<T>::_t (const T& t) : type_traits::value<T>{ t }
|
|
595
|
+
{
|
|
596
|
+
}
|
|
597
|
+
|
|
598
|
+
/**
|
|
599
|
+
* @details
|
|
600
|
+
* Constructs a `to_t` instance by forwarding the provided value to the
|
|
601
|
+
* base `type_traits::value<T>` wrapper.
|
|
602
|
+
*/
|
|
603
|
+
template <class T>
|
|
604
|
+
constexpr to_t<T>::to_t (const T& t) : type_traits::value<T>{ t }
|
|
605
|
+
{
|
|
606
|
+
}
|
|
607
|
+
|
|
586
608
|
// --------------------------------------------------------------------------
|
|
587
609
|
} // namespace micro_os_plus::micro_test_plus
|
|
588
610
|
|
|
@@ -93,7 +93,7 @@ namespace micro_os_plus::micro_test_plus
|
|
|
93
93
|
* less efficient, or not constexpr.
|
|
94
94
|
*/
|
|
95
95
|
template <class T>
|
|
96
|
-
|
|
96
|
+
constexpr auto
|
|
97
97
|
abs (const T t) noexcept -> T
|
|
98
98
|
{
|
|
99
99
|
return t < T{} ? -t : t;
|
|
@@ -114,7 +114,7 @@ namespace micro_os_plus::micro_test_plus
|
|
|
114
114
|
* less efficient, or not constexpr.
|
|
115
115
|
*/
|
|
116
116
|
template <class T>
|
|
117
|
-
|
|
117
|
+
constexpr auto
|
|
118
118
|
min_value (const T& lhs, const T& rhs) noexcept -> const T&
|
|
119
119
|
{
|
|
120
120
|
return (rhs < lhs) ? rhs : lhs;
|
|
@@ -135,7 +135,7 @@ namespace micro_os_plus::micro_test_plus
|
|
|
135
135
|
* less efficient, or not constexpr.
|
|
136
136
|
*/
|
|
137
137
|
template <class T, class Exp_T>
|
|
138
|
-
|
|
138
|
+
constexpr auto
|
|
139
139
|
pow (const T base, const Exp_T exp) noexcept -> T
|
|
140
140
|
{
|
|
141
141
|
T result{ 1 };
|
|
@@ -159,7 +159,7 @@ namespace micro_os_plus::micro_test_plus
|
|
|
159
159
|
* conversion from character sequences to integral values.
|
|
160
160
|
*/
|
|
161
161
|
template <class T, char... Cs>
|
|
162
|
-
|
|
162
|
+
consteval auto
|
|
163
163
|
num (void) -> T
|
|
164
164
|
{
|
|
165
165
|
// Assume all are digits or dot or apostrophe.
|
|
@@ -199,7 +199,7 @@ namespace micro_os_plus::micro_test_plus
|
|
|
199
199
|
* values.
|
|
200
200
|
*/
|
|
201
201
|
template <class T, char... Cs>
|
|
202
|
-
|
|
202
|
+
consteval auto
|
|
203
203
|
den (void) -> T
|
|
204
204
|
{
|
|
205
205
|
static_assert ((... || (Cs == '.')),
|
|
@@ -234,7 +234,7 @@ namespace micro_os_plus::micro_test_plus
|
|
|
234
234
|
* determination of decimal precision from character sequences.
|
|
235
235
|
*/
|
|
236
236
|
template <class T, char... Cs>
|
|
237
|
-
|
|
237
|
+
consteval auto
|
|
238
238
|
den_size (void) -> T
|
|
239
239
|
{
|
|
240
240
|
static_assert ((... || (Cs == '.')),
|
|
@@ -272,7 +272,7 @@ namespace micro_os_plus::micro_test_plus
|
|
|
272
272
|
* determination of decimal precision from floating-point values.
|
|
273
273
|
*/
|
|
274
274
|
template <class T, class Value_T>
|
|
275
|
-
|
|
275
|
+
constexpr auto
|
|
276
276
|
den_size (Value_T value) -> T
|
|
277
277
|
{
|
|
278
278
|
constexpr auto precision = Value_T (1e-7);
|