@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
|
@@ -54,6 +54,10 @@
|
|
|
54
54
|
#include <charconv>
|
|
55
55
|
#include <cstdio>
|
|
56
56
|
|
|
57
|
+
#if defined(MICRO_OS_PLUS_TRACE)
|
|
58
|
+
#include <micro-os-plus/diag/trace.h>
|
|
59
|
+
#endif // MICRO_OS_PLUS_TRACE
|
|
60
|
+
|
|
57
61
|
// ----------------------------------------------------------------------------
|
|
58
62
|
|
|
59
63
|
#if defined(__GNUC__)
|
|
@@ -73,6 +77,18 @@ namespace micro_os_plus::micro_test_plus
|
|
|
73
77
|
|
|
74
78
|
namespace detail
|
|
75
79
|
{
|
|
80
|
+
// ========================================================================
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* @details
|
|
84
|
+
* Returns the result value stored in `value_`.
|
|
85
|
+
*/
|
|
86
|
+
inline bool
|
|
87
|
+
deferred_reporter_base::value () const
|
|
88
|
+
{
|
|
89
|
+
return value_;
|
|
90
|
+
}
|
|
91
|
+
|
|
76
92
|
// ------------------------------------------------------------------------
|
|
77
93
|
|
|
78
94
|
/**
|
|
@@ -138,44 +154,23 @@ namespace micro_os_plus::micro_test_plus
|
|
|
138
154
|
* contextual information for reporting purposes.
|
|
139
155
|
*/
|
|
140
156
|
template <class Expr_T>
|
|
141
|
-
deferred_reporter
|
|
157
|
+
deferred_reporter::deferred_reporter (
|
|
142
158
|
const Expr_T& expr, bool abort,
|
|
143
|
-
const reflection::source_location& location, subtest& subtest
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
159
|
+
const reflection::source_location& location, subtest& subtest,
|
|
160
|
+
expression_formatter& expression)
|
|
161
|
+
: deferred_reporter_base{ static_cast<bool> (expr), location, subtest }
|
|
162
|
+
|
|
147
163
|
{
|
|
148
164
|
#if defined(MICRO_OS_PLUS_TRACE) \
|
|
149
165
|
&& defined(MICRO_OS_PLUS_TRACE_MICRO_TEST_PLUS_CONSTRUCTORS)
|
|
150
166
|
trace::printf ("%s\n", __PRETTY_FUNCTION__);
|
|
151
167
|
#endif // MICRO_OS_PLUS_TRACE_MICRO_TEST_PLUS_CONSTRUCTORS
|
|
152
168
|
abort_ = abort;
|
|
153
|
-
|
|
169
|
+
has_expression_ = type_traits::is_op<Expr_T>;
|
|
154
170
|
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
* expression. If the evaluated expression is true, the reporter records a
|
|
159
|
-
* successful outcome along with any accumulated message. If the expression
|
|
160
|
-
* is false, the reporter records a failure, including the abort status,
|
|
161
|
-
* message, and source location for comprehensive reporting.
|
|
162
|
-
*
|
|
163
|
-
* This mechanism ensures that all relevant information about the test
|
|
164
|
-
* outcome is captured and reported accurately when the deferred reporter
|
|
165
|
-
* goes out of scope.
|
|
166
|
-
*/
|
|
167
|
-
template <class Expr_T>
|
|
168
|
-
deferred_reporter<Expr_T>::~deferred_reporter ()
|
|
169
|
-
{
|
|
170
|
-
if (value_) [[likely]]
|
|
171
|
-
{
|
|
172
|
-
subtest_.reporter ().pass (expr_, deferred_output_, subtest_);
|
|
173
|
-
}
|
|
174
|
-
else
|
|
175
|
-
{
|
|
176
|
-
subtest_.reporter ().fail (expr_, abort_, deferred_output_,
|
|
177
|
-
location_, subtest_);
|
|
178
|
-
}
|
|
171
|
+
expression.clear ();
|
|
172
|
+
|
|
173
|
+
expression << expr;
|
|
179
174
|
}
|
|
180
175
|
|
|
181
176
|
// ------------------------------------------------------------------------
|