@micro-os-plus/micro-test-plus 3.2.3 → 3.3.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 +76 -2
- package/CMakeLists.txt +2 -1
- package/README.md +1 -1
- package/include/micro-os-plus/micro-test-plus/detail.h +173 -150
- package/include/micro-os-plus/micro-test-plus/inlines/details-inlines.h +2 -2
- package/include/micro-os-plus/micro-test-plus/inlines/test-reporter-inlines.h +8 -3
- package/include/micro-os-plus/micro-test-plus/test-reporter-basic.h +289 -0
- package/include/micro-os-plus/micro-test-plus/test-reporter-tap.h +281 -0
- package/include/micro-os-plus/micro-test-plus/test-reporter.h +72 -27
- package/include/micro-os-plus/micro-test-plus/test-runner.h +55 -15
- package/include/micro-os-plus/micro-test-plus/test-suite.h +47 -11
- package/include/micro-os-plus/micro-test-plus.h +4 -2
- package/meson.build +2 -0
- package/package.json +1 -1
- package/src/micro-test-plus.cpp +6 -5
- package/src/test-reporter-basic.cpp +466 -0
- package/src/test-reporter-tap.cpp +530 -0
- package/src/test-reporter.cpp +5 -380
- package/src/test-runner.cpp +66 -18
- package/src/test-suite.cpp +58 -5
package/CHANGELOG.md
CHANGED
|
@@ -6,10 +6,84 @@ Please check
|
|
|
6
6
|
[GitHub](https://github.com/micro-os-plus/micro-test-plus-xpack/issues/)
|
|
7
7
|
and close existing issues and pull requests.
|
|
8
8
|
|
|
9
|
+
## 2026-03-23
|
|
10
|
+
|
|
11
|
+
* v3.3.1 published on npmjs.com
|
|
12
|
+
* v3.3.1 prepared
|
|
13
|
+
* f1be263 tests: add suite-test
|
|
14
|
+
* df22b28 #16: fix static inits
|
|
15
|
+
* 511f8cf re-generate website commons
|
|
16
|
+
* c700756 tests meson update usage
|
|
17
|
+
* 759051f move tests to sources
|
|
18
|
+
|
|
19
|
+
## 2026-03-22
|
|
20
|
+
|
|
21
|
+
* fd91598 website: blog post release 3.3.0 published
|
|
22
|
+
* a116185 3.3.0
|
|
23
|
+
* c412e55 CHANGELOG: publish npm v3.3.0
|
|
24
|
+
* 394c679 prepare v3.3.0
|
|
25
|
+
* 8d33c3e website update for tap
|
|
26
|
+
* 181b428 website/doxygen rewrites
|
|
27
|
+
* 14bea0a cli.dox update to tap
|
|
28
|
+
* 4a4f840 #9: fix empty line
|
|
29
|
+
* ae54b12 cmake cosmetics
|
|
30
|
+
* 3cb5a08 #10: fix not ok messages
|
|
31
|
+
* 2fda6fc #10: fix rounding
|
|
32
|
+
|
|
33
|
+
## 2026-03-21
|
|
34
|
+
|
|
35
|
+
* 1e2c980 empty .npmignore in tests
|
|
36
|
+
* 2242fd0 test-reporter-tap.cpp cosmetics
|
|
37
|
+
* a3ecec4 try timespec_get only on win32
|
|
38
|
+
* 7ba0701 try timespec_get
|
|
39
|
+
* 9ead310 #if defined(CLOCK_MONOTONIC)
|
|
40
|
+
* 4e9478c Revert "try -lwinpthread on windows"
|
|
41
|
+
* 951742a try -lwinpthread on windows
|
|
42
|
+
* 5bce849 #10: fix long long warning
|
|
43
|
+
|
|
44
|
+
## 2026-03-20
|
|
45
|
+
|
|
46
|
+
* f9c0293 Revert "#10: use defined(__linux__)"
|
|
47
|
+
* 574ff65 #10: fix duplicate struct timespec
|
|
48
|
+
* cbdc8ed #10: use defined(__linux__)
|
|
49
|
+
* 15a191d #10: show total time
|
|
50
|
+
* 3bae621 make runner default_test_suite public
|
|
51
|
+
* e25dbf3 #10: add elapsed time to suites
|
|
52
|
+
* 0139c5e test-reporter-*.cpp plurals
|
|
53
|
+
|
|
54
|
+
## 2026-03-19
|
|
55
|
+
|
|
56
|
+
* 9258c55 cli.dox update
|
|
57
|
+
* 022cbed test-reporter: fix syntax
|
|
58
|
+
* cc95083 website update
|
|
59
|
+
* e4c6be1 #9: default tap
|
|
60
|
+
* 84b34d3 native cmake with explicit --reporter
|
|
61
|
+
* e35ad6a #9: functional test-reporter-tap
|
|
62
|
+
* 7aa70ac test-runner: add totals
|
|
63
|
+
* f6a2bc1 add begin/end_test
|
|
64
|
+
* 7d6f684 test-suite.h: size_t analytics
|
|
65
|
+
* 1e7a54c detail.h: reformat
|
|
66
|
+
|
|
67
|
+
## 2026-03-18
|
|
68
|
+
|
|
69
|
+
* 7bae711 add suite index
|
|
70
|
+
* 6619d3b default basic
|
|
71
|
+
* 5465c38 rename test_suites_
|
|
72
|
+
* c60d2b5 rename test_cases_count
|
|
73
|
+
* 459d10c #9: process --reporter=tap or basic
|
|
74
|
+
* 2c8cc51 #9: add a test-reporter-tap as a duplicate of base
|
|
75
|
+
* 122c76a #11: make the test_reporter_basic class final to avoid warnings
|
|
76
|
+
* d84d2b8 #11: extract test_runner_basic in separate files
|
|
77
|
+
* 75b8fb1 #11: move operator implementations back to the base class
|
|
78
|
+
* 096d136 #11: make the test_reporter an abstract class
|
|
79
|
+
* 8f20d22 #13: access the reporter via a pointer
|
|
80
|
+
|
|
9
81
|
## 2026-03-17
|
|
10
82
|
|
|
11
|
-
*
|
|
12
|
-
*
|
|
83
|
+
* 42e0810 website: blog post release 3.2.3 published
|
|
84
|
+
* b84b446 3.2.3
|
|
85
|
+
* aeda731 CHANGELOG: publish npm v3.2.3
|
|
86
|
+
* 7d877be prepare v3.2.3
|
|
13
87
|
* 7943290 package.json update
|
|
14
88
|
* d40573b settings.json update
|
|
15
89
|
* 6eaed82 re-generate website
|
package/CMakeLists.txt
CHANGED
|
@@ -53,7 +53,8 @@ target_include_directories(
|
|
|
53
53
|
target_sources(
|
|
54
54
|
micro-os-plus-micro-test-plus-interface
|
|
55
55
|
INTERFACE "src/micro-test-plus.cpp" "src/test-runner.cpp"
|
|
56
|
-
"src/test-reporter.cpp" "src/test-
|
|
56
|
+
"src/test-reporter.cpp" "src/test-reporter-basic.cpp"
|
|
57
|
+
"src/test-reporter-tap.cpp" "src/test-suite.cpp"
|
|
57
58
|
)
|
|
58
59
|
|
|
59
60
|
target_compile_definitions(
|
package/README.md
CHANGED
|
@@ -15,7 +15,7 @@ For information on how to install and use this project, please refer to the
|
|
|
15
15
|
## Project source
|
|
16
16
|
|
|
17
17
|
The source code of the current release is available on
|
|
18
|
-
[GitHub tag v3.
|
|
18
|
+
[GitHub tag v3.3.1 tree](https://github.com/micro-os-plus/micro-test-plus-xpack/tree/v3.3.1).
|
|
19
19
|
|
|
20
20
|
## License
|
|
21
21
|
|
|
@@ -270,11 +270,13 @@ namespace micro_os_plus::micro_test_plus
|
|
|
270
270
|
* result is stored in the `value_` member for efficient access.
|
|
271
271
|
*/
|
|
272
272
|
constexpr eq_ (const Lhs_T& lhs = {}, const Rhs_T& rhs = {})
|
|
273
|
-
: lhs_{ lhs }, rhs_{ rhs }, value_{
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
273
|
+
: lhs_{ lhs }, rhs_{ rhs }, value_{
|
|
274
|
+
[&]
|
|
275
|
+
{
|
|
276
|
+
// This lambda is called in the constructor to
|
|
277
|
+
// evaluate the comparison.
|
|
278
|
+
using std::operator==;
|
|
279
|
+
using std::operator<;
|
|
278
280
|
|
|
279
281
|
#if defined(__GNUC__)
|
|
280
282
|
#pragma GCC diagnostic push
|
|
@@ -287,41 +289,45 @@ namespace micro_os_plus::micro_test_plus
|
|
|
287
289
|
#pragma clang diagnostic ignored "-Wpedantic"
|
|
288
290
|
#endif
|
|
289
291
|
#endif
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
292
|
+
if constexpr (type_traits::has_value_v<Lhs_T>
|
|
293
|
+
and type_traits::has_value_v<Rhs_T>)
|
|
294
|
+
{
|
|
295
|
+
// If both types have values (like numeric constants),
|
|
296
|
+
// compare them directly.
|
|
297
|
+
return Lhs_T::value == Rhs_T::value;
|
|
298
|
+
}
|
|
299
|
+
else if constexpr (type_traits::has_epsilon_v<Lhs_T>
|
|
300
|
+
and type_traits::has_epsilon_v<Rhs_T>)
|
|
301
|
+
{
|
|
302
|
+
// If both values have precision, compare them using
|
|
303
|
+
// the smalles precision.
|
|
304
|
+
return math::abs (get (lhs) - get (rhs))
|
|
305
|
+
< math::min_value (Lhs_T::epsilon,
|
|
306
|
+
Rhs_T::epsilon);
|
|
307
|
+
}
|
|
308
|
+
else if constexpr (type_traits::has_epsilon_v<Lhs_T>)
|
|
309
|
+
{
|
|
310
|
+
// If only the left operand has precision, use it.
|
|
311
|
+
return math::abs (get (lhs) - get (rhs))
|
|
312
|
+
< Lhs_T::epsilon;
|
|
313
|
+
}
|
|
314
|
+
else if constexpr (type_traits::has_epsilon_v<Rhs_T>)
|
|
315
|
+
{
|
|
316
|
+
// If only the right operand has precision, use it.
|
|
317
|
+
return math::abs (get (lhs) - get (rhs))
|
|
318
|
+
< Rhs_T::epsilon;
|
|
319
|
+
}
|
|
320
|
+
else
|
|
321
|
+
{
|
|
322
|
+
// Call the generic getters, which might
|
|
323
|
+
// either call the type get() or return the value.
|
|
324
|
+
return get (lhs) == get (rhs);
|
|
325
|
+
}
|
|
321
326
|
#if defined(__GNUC__)
|
|
322
327
|
#pragma GCC diagnostic pop
|
|
323
328
|
#endif
|
|
324
|
-
|
|
329
|
+
}()
|
|
330
|
+
}
|
|
325
331
|
{
|
|
326
332
|
}
|
|
327
333
|
|
|
@@ -442,10 +448,12 @@ namespace micro_os_plus::micro_test_plus
|
|
|
442
448
|
* result is stored in the `value_` member for efficient access.
|
|
443
449
|
*/
|
|
444
450
|
constexpr ne_ (const Lhs_T& lhs = {}, const Rhs_T& rhs = {})
|
|
445
|
-
: lhs_{ lhs }, rhs_{ rhs }, value_{
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
451
|
+
: lhs_{ lhs }, rhs_{ rhs }, value_{
|
|
452
|
+
[&]
|
|
453
|
+
{
|
|
454
|
+
using std::operator==;
|
|
455
|
+
using std::operator!=;
|
|
456
|
+
using std::operator>;
|
|
449
457
|
|
|
450
458
|
#if defined(__GNUC__)
|
|
451
459
|
#pragma GCC diagnostic push
|
|
@@ -458,33 +466,37 @@ namespace micro_os_plus::micro_test_plus
|
|
|
458
466
|
#pragma clang diagnostic ignored "-Wpedantic"
|
|
459
467
|
#endif
|
|
460
468
|
#endif
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
469
|
+
if constexpr (type_traits::has_value_v<Lhs_T>
|
|
470
|
+
and type_traits::has_value_v<Rhs_T>)
|
|
471
|
+
{
|
|
472
|
+
return Lhs_T::value != Rhs_T::value;
|
|
473
|
+
}
|
|
474
|
+
else if constexpr (type_traits::has_epsilon_v<Lhs_T>
|
|
475
|
+
and type_traits::has_epsilon_v<Rhs_T>)
|
|
476
|
+
{
|
|
477
|
+
return math::abs (get (lhs_) - get (rhs_))
|
|
478
|
+
> math::min_value (Lhs_T::epsilon,
|
|
479
|
+
Rhs_T::epsilon);
|
|
480
|
+
}
|
|
481
|
+
else if constexpr (type_traits::has_epsilon_v<Lhs_T>)
|
|
482
|
+
{
|
|
483
|
+
return math::abs (get (lhs_) - get (rhs_))
|
|
484
|
+
> Lhs_T::epsilon;
|
|
485
|
+
}
|
|
486
|
+
else if constexpr (type_traits::has_epsilon_v<Rhs_T>)
|
|
487
|
+
{
|
|
488
|
+
return math::abs (get (lhs_) - get (rhs_))
|
|
489
|
+
> Rhs_T::epsilon;
|
|
490
|
+
}
|
|
491
|
+
else
|
|
492
|
+
{
|
|
493
|
+
return get (lhs_) != get (rhs_);
|
|
494
|
+
}
|
|
484
495
|
#if defined(__GNUC__)
|
|
485
496
|
#pragma GCC diagnostic pop
|
|
486
497
|
#endif
|
|
487
|
-
|
|
498
|
+
}()
|
|
499
|
+
}
|
|
488
500
|
{
|
|
489
501
|
}
|
|
490
502
|
|
|
@@ -603,8 +615,10 @@ namespace micro_os_plus::micro_test_plus
|
|
|
603
615
|
* The result is stored in the `value_` member for efficient access.
|
|
604
616
|
*/
|
|
605
617
|
constexpr gt_ (const Lhs_T& lhs = {}, const Rhs_T& rhs = {})
|
|
606
|
-
: lhs_{ lhs }, rhs_{ rhs },
|
|
607
|
-
|
|
618
|
+
: lhs_{ lhs }, rhs_{ rhs },
|
|
619
|
+
value_{ [&]
|
|
620
|
+
{
|
|
621
|
+
using std::operator>;
|
|
608
622
|
|
|
609
623
|
#if defined(__GNUC__)
|
|
610
624
|
#pragma GCC diagnostic push
|
|
@@ -616,19 +630,19 @@ namespace micro_os_plus::micro_test_plus
|
|
|
616
630
|
#pragma clang diagnostic ignored "-Wpedantic"
|
|
617
631
|
#endif
|
|
618
632
|
#endif
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
633
|
+
if constexpr (type_traits::has_value_v<Lhs_T>
|
|
634
|
+
and type_traits::has_value_v<Rhs_T>)
|
|
635
|
+
{
|
|
636
|
+
return Lhs_T::value > Rhs_T::value;
|
|
637
|
+
}
|
|
638
|
+
else
|
|
639
|
+
{
|
|
640
|
+
return get (lhs_) > get (rhs_);
|
|
641
|
+
}
|
|
628
642
|
#if defined(__GNUC__)
|
|
629
643
|
#pragma GCC diagnostic pop
|
|
630
644
|
#endif
|
|
631
|
-
|
|
645
|
+
}() }
|
|
632
646
|
{
|
|
633
647
|
}
|
|
634
648
|
|
|
@@ -750,8 +764,10 @@ namespace micro_os_plus::micro_test_plus
|
|
|
750
764
|
* efficient access.
|
|
751
765
|
*/
|
|
752
766
|
constexpr ge_ (const Lhs_T& lhs = {}, const Rhs_T& rhs = {})
|
|
753
|
-
: lhs_{ lhs }, rhs_{ rhs },
|
|
754
|
-
|
|
767
|
+
: lhs_{ lhs }, rhs_{ rhs },
|
|
768
|
+
value_{ [&]
|
|
769
|
+
{
|
|
770
|
+
using std::operator>=;
|
|
755
771
|
|
|
756
772
|
#if defined(__GNUC__)
|
|
757
773
|
#pragma GCC diagnostic push
|
|
@@ -763,19 +779,19 @@ namespace micro_os_plus::micro_test_plus
|
|
|
763
779
|
#pragma clang diagnostic ignored "-Wpedantic"
|
|
764
780
|
#endif
|
|
765
781
|
#endif
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
782
|
+
if constexpr (type_traits::has_value_v<Lhs_T>
|
|
783
|
+
and type_traits::has_value_v<Rhs_T>)
|
|
784
|
+
{
|
|
785
|
+
return Lhs_T::value >= Rhs_T::value;
|
|
786
|
+
}
|
|
787
|
+
else
|
|
788
|
+
{
|
|
789
|
+
return get (lhs_) >= get (rhs_);
|
|
790
|
+
}
|
|
775
791
|
#if defined(__GNUC__)
|
|
776
792
|
#pragma GCC diagnostic pop
|
|
777
793
|
#endif
|
|
778
|
-
|
|
794
|
+
}() }
|
|
779
795
|
{
|
|
780
796
|
}
|
|
781
797
|
|
|
@@ -895,8 +911,10 @@ namespace micro_os_plus::micro_test_plus
|
|
|
895
911
|
* The result is stored in the `value_` member for efficient access.
|
|
896
912
|
*/
|
|
897
913
|
constexpr lt_ (const Lhs_T& lhs = {}, const Rhs_T& rhs = {})
|
|
898
|
-
: lhs_{ lhs }, rhs_{ rhs },
|
|
899
|
-
|
|
914
|
+
: lhs_{ lhs }, rhs_{ rhs },
|
|
915
|
+
value_{ [&]
|
|
916
|
+
{
|
|
917
|
+
using std::operator<;
|
|
900
918
|
|
|
901
919
|
#if defined(__GNUC__)
|
|
902
920
|
#pragma GCC diagnostic push
|
|
@@ -908,19 +926,19 @@ namespace micro_os_plus::micro_test_plus
|
|
|
908
926
|
#pragma clang diagnostic ignored "-Wpedantic"
|
|
909
927
|
#endif
|
|
910
928
|
#endif
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
929
|
+
if constexpr (type_traits::has_value_v<Lhs_T>
|
|
930
|
+
and type_traits::has_value_v<Rhs_T>)
|
|
931
|
+
{
|
|
932
|
+
return Lhs_T::value < Rhs_T::value;
|
|
933
|
+
}
|
|
934
|
+
else
|
|
935
|
+
{
|
|
936
|
+
return get (lhs_) < get (rhs_);
|
|
937
|
+
}
|
|
920
938
|
#if defined(__GNUC__)
|
|
921
939
|
#pragma GCC diagnostic pop
|
|
922
940
|
#endif
|
|
923
|
-
|
|
941
|
+
}() }
|
|
924
942
|
{
|
|
925
943
|
}
|
|
926
944
|
|
|
@@ -1043,8 +1061,10 @@ namespace micro_os_plus::micro_test_plus
|
|
|
1043
1061
|
* efficient access.
|
|
1044
1062
|
*/
|
|
1045
1063
|
constexpr le_ (const Lhs_T& lhs = {}, const Rhs_T& rhs = {})
|
|
1046
|
-
: lhs_{ lhs }, rhs_{ rhs },
|
|
1047
|
-
|
|
1064
|
+
: lhs_{ lhs }, rhs_{ rhs },
|
|
1065
|
+
value_{ [&]
|
|
1066
|
+
{
|
|
1067
|
+
using std::operator<=;
|
|
1048
1068
|
|
|
1049
1069
|
#if defined(__GNUC__)
|
|
1050
1070
|
#pragma GCC diagnostic push
|
|
@@ -1056,19 +1076,19 @@ namespace micro_os_plus::micro_test_plus
|
|
|
1056
1076
|
#pragma clang diagnostic ignored "-Wpedantic"
|
|
1057
1077
|
#endif
|
|
1058
1078
|
#endif
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1079
|
+
if constexpr (type_traits::has_value_v<Lhs_T>
|
|
1080
|
+
and type_traits::has_value_v<Rhs_T>)
|
|
1081
|
+
{
|
|
1082
|
+
return Lhs_T::value <= Rhs_T::value;
|
|
1083
|
+
}
|
|
1084
|
+
else
|
|
1085
|
+
{
|
|
1086
|
+
return get (lhs_) <= get (rhs_);
|
|
1087
|
+
}
|
|
1068
1088
|
#if defined(__GNUC__)
|
|
1069
1089
|
#pragma GCC diagnostic pop
|
|
1070
1090
|
#endif
|
|
1071
|
-
|
|
1091
|
+
}() }
|
|
1072
1092
|
{
|
|
1073
1093
|
}
|
|
1074
1094
|
|
|
@@ -1522,21 +1542,22 @@ namespace micro_os_plus::micro_test_plus
|
|
|
1522
1542
|
* member for efficient access.
|
|
1523
1543
|
*/
|
|
1524
1544
|
constexpr explicit throws_ (const Callable_T& func)
|
|
1525
|
-
: value_{ [&func]
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1545
|
+
: value_{ [&func]
|
|
1546
|
+
{
|
|
1547
|
+
try
|
|
1548
|
+
{
|
|
1549
|
+
func ();
|
|
1550
|
+
}
|
|
1551
|
+
catch (const Exception_T&)
|
|
1552
|
+
{
|
|
1553
|
+
return true;
|
|
1554
|
+
}
|
|
1555
|
+
catch (...)
|
|
1556
|
+
{
|
|
1557
|
+
return false;
|
|
1558
|
+
}
|
|
1559
|
+
return false;
|
|
1560
|
+
}() }
|
|
1540
1561
|
{
|
|
1541
1562
|
}
|
|
1542
1563
|
|
|
@@ -1605,17 +1626,18 @@ namespace micro_os_plus::micro_test_plus
|
|
|
1605
1626
|
* @param func The callable object to be invoked.
|
|
1606
1627
|
*/
|
|
1607
1628
|
constexpr explicit throws_ (const Callable_T& func)
|
|
1608
|
-
: value_{ [&func]
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1629
|
+
: value_{ [&func]
|
|
1630
|
+
{
|
|
1631
|
+
try
|
|
1632
|
+
{
|
|
1633
|
+
func ();
|
|
1634
|
+
}
|
|
1635
|
+
catch (...)
|
|
1636
|
+
{
|
|
1637
|
+
return true;
|
|
1638
|
+
}
|
|
1639
|
+
return false;
|
|
1640
|
+
}() }
|
|
1619
1641
|
{
|
|
1620
1642
|
}
|
|
1621
1643
|
|
|
@@ -1682,17 +1704,18 @@ namespace micro_os_plus::micro_test_plus
|
|
|
1682
1704
|
* member for efficient access.
|
|
1683
1705
|
*/
|
|
1684
1706
|
constexpr explicit nothrow_ (const Callable_T& func)
|
|
1685
|
-
: value_{ [&func]
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1707
|
+
: value_{ [&func]
|
|
1708
|
+
{
|
|
1709
|
+
try
|
|
1710
|
+
{
|
|
1711
|
+
func ();
|
|
1712
|
+
}
|
|
1713
|
+
catch (...)
|
|
1714
|
+
{
|
|
1715
|
+
return false;
|
|
1716
|
+
}
|
|
1717
|
+
return true;
|
|
1718
|
+
}() }
|
|
1696
1719
|
{
|
|
1697
1720
|
}
|
|
1698
1721
|
|
|
@@ -143,11 +143,11 @@ namespace micro_os_plus::micro_test_plus
|
|
|
143
143
|
{
|
|
144
144
|
if (value_)
|
|
145
145
|
{
|
|
146
|
-
reporter
|
|
146
|
+
reporter->pass (expr_, message_);
|
|
147
147
|
}
|
|
148
148
|
else
|
|
149
149
|
{
|
|
150
|
-
reporter
|
|
150
|
+
reporter->fail (expr_, abort_, message_, location_);
|
|
151
151
|
}
|
|
152
152
|
}
|
|
153
153
|
|
|
@@ -418,6 +418,8 @@ namespace micro_os_plus::micro_test_plus
|
|
|
418
418
|
void
|
|
419
419
|
test_reporter::pass (Expr_T& expr, std::string& message)
|
|
420
420
|
{
|
|
421
|
+
current_test_suite->current_test_case.index++;
|
|
422
|
+
|
|
421
423
|
output_pass_prefix_ (message);
|
|
422
424
|
|
|
423
425
|
if (message.empty ())
|
|
@@ -443,14 +445,17 @@ namespace micro_os_plus::micro_test_plus
|
|
|
443
445
|
test_reporter::fail (Expr_T& expr, bool abort, std::string& message,
|
|
444
446
|
const reflection::source_location& location)
|
|
445
447
|
{
|
|
446
|
-
|
|
448
|
+
current_test_suite->current_test_case.index++;
|
|
449
|
+
|
|
450
|
+
const bool hasExpression = type_traits::is_op_v<Expr_T>;
|
|
451
|
+
output_fail_prefix_ (message, hasExpression, location);
|
|
447
452
|
|
|
448
453
|
if constexpr (type_traits::is_op_v<Expr_T>)
|
|
449
454
|
{
|
|
450
|
-
*this <<
|
|
455
|
+
*this << expr;
|
|
451
456
|
}
|
|
452
457
|
|
|
453
|
-
output_fail_suffix_ (abort);
|
|
458
|
+
output_fail_suffix_ (location, abort);
|
|
454
459
|
}
|
|
455
460
|
|
|
456
461
|
// --------------------------------------------------------------------------
|