@micro-os-plus/micro-test-plus 3.3.1 → 4.0.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 +330 -2
- package/CMakeLists.txt +79 -23
- package/README.md +1 -1
- package/config/xcdl-build.json +11 -4
- package/include/micro-os-plus/micro-test-plus/deferred-reporter.h +292 -0
- package/include/micro-os-plus/micro-test-plus/detail.h +462 -1076
- package/include/micro-os-plus/micro-test-plus/exceptions.h +126 -0
- package/include/micro-os-plus/micro-test-plus/function-comparators.h +10 -7
- package/include/micro-os-plus/micro-test-plus/inlines/{details-inlines.h → deferred-reporter-inlines.h} +49 -22
- package/include/micro-os-plus/micro-test-plus/inlines/function-comparators-inlines.h +67 -4
- package/include/micro-os-plus/micro-test-plus/inlines/literals-inlines.h +3 -6
- package/include/micro-os-plus/micro-test-plus/inlines/math-inlines.h +21 -15
- package/include/micro-os-plus/micro-test-plus/inlines/reflection-inlines.h +35 -17
- package/include/micro-os-plus/micro-test-plus/inlines/{test-reporter-inlines.h → reporter-inlines.h} +176 -106
- package/include/micro-os-plus/micro-test-plus/inlines/{test-suite-inlines.h → runner-inlines.h} +41 -43
- package/include/micro-os-plus/micro-test-plus/inlines/test-inlines.h +369 -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 +4 -3
- package/include/micro-os-plus/micro-test-plus/math.h +9 -6
- package/include/micro-os-plus/micro-test-plus/operators.h +38 -44
- package/include/micro-os-plus/micro-test-plus/reflection.h +15 -4
- package/include/micro-os-plus/micro-test-plus/{test-reporter-basic.h → reporter-human.h} +72 -72
- package/include/micro-os-plus/micro-test-plus/{test-reporter-tap.h → reporter-tap.h} +69 -69
- package/include/micro-os-plus/micro-test-plus/{test-reporter.h → reporter.h} +296 -200
- package/include/micro-os-plus/micro-test-plus/runner-totals.h +264 -0
- package/include/micro-os-plus/micro-test-plus/runner.h +453 -0
- package/include/micro-os-plus/micro-test-plus/test.h +1069 -0
- package/include/micro-os-plus/micro-test-plus/timings.h +366 -0
- package/include/micro-os-plus/micro-test-plus/type-traits.h +239 -545
- package/include/micro-os-plus/micro-test-plus/utility.h +135 -0
- package/include/micro-os-plus/micro-test-plus.h +25 -228
- package/meson.build +10 -6
- package/package.json +1 -1
- package/src/deferred-reporter.cpp +118 -0
- package/src/reflection.cpp +95 -0
- package/src/reporter-human.cpp +822 -0
- package/src/reporter-tap.cpp +782 -0
- package/src/reporter.cpp +676 -0
- package/src/runner-totals.cpp +95 -0
- package/src/runner.cpp +563 -0
- package/src/test.cpp +496 -0
- package/src/timings.cpp +209 -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/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
|
@@ -20,8 +20,8 @@
|
|
|
20
20
|
* @brief C++ header file with declarations for the µTest++ TAP test reporter.
|
|
21
21
|
*
|
|
22
22
|
* @details
|
|
23
|
-
* This header provides the declaration for `
|
|
24
|
-
* implementation of the `
|
|
23
|
+
* This header provides the declaration for `reporter_tap`, a concrete
|
|
24
|
+
* implementation of the `reporter` abstract interface that formats test
|
|
25
25
|
* results according to the Test Anything Protocol (TAP).
|
|
26
26
|
*
|
|
27
27
|
* All definitions reside within the `micro_os_plus::micro_test_plus`
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
|
|
46
46
|
// ----------------------------------------------------------------------------
|
|
47
47
|
|
|
48
|
-
#include "
|
|
48
|
+
#include "reporter.h"
|
|
49
49
|
|
|
50
50
|
// ----------------------------------------------------------------------------
|
|
51
51
|
|
|
@@ -57,21 +57,23 @@
|
|
|
57
57
|
#endif
|
|
58
58
|
#endif
|
|
59
59
|
|
|
60
|
+
// ============================================================================
|
|
61
|
+
|
|
60
62
|
namespace micro_os_plus::micro_test_plus
|
|
61
63
|
{
|
|
62
64
|
// --------------------------------------------------------------------------
|
|
63
65
|
|
|
64
66
|
/**
|
|
65
|
-
* @brief TAP (Test Anything Protocol) implementation of `
|
|
67
|
+
* @brief TAP (Test Anything Protocol) implementation of `reporter`.
|
|
66
68
|
*
|
|
67
69
|
* @details
|
|
68
|
-
* `
|
|
69
|
-
* `
|
|
70
|
+
* `reporter_tap` provides a concrete implementation of the
|
|
71
|
+
* `reporter` abstract interface that formats test results according to
|
|
70
72
|
* the Test Anything Protocol (TAP). It accumulates output in an internal
|
|
71
73
|
* string buffer and writes it to the standard output stream.
|
|
72
74
|
*
|
|
73
75
|
* Users who require custom output behaviour (e.g. redirecting to a serial
|
|
74
|
-
* port on bare-metal targets) may derive a new class from `
|
|
76
|
+
* port on bare-metal targets) may derive a new class from `reporter`
|
|
75
77
|
* and supply an instance via the `reporter` global pointer before calling
|
|
76
78
|
* `initialize()`.
|
|
77
79
|
*
|
|
@@ -81,160 +83,155 @@ namespace micro_os_plus::micro_test_plus
|
|
|
81
83
|
*
|
|
82
84
|
* @headerfile micro-test-plus.h <micro-os-plus/micro-test-plus.h>
|
|
83
85
|
*/
|
|
84
|
-
class
|
|
86
|
+
class reporter_tap final : public reporter
|
|
85
87
|
{
|
|
86
88
|
public:
|
|
87
89
|
/**
|
|
88
|
-
* @brief
|
|
90
|
+
* @brief Constructor for the reporter_tap class.
|
|
89
91
|
*
|
|
90
92
|
* @details
|
|
91
93
|
* The rule of five is enforced to prevent accidental copying or moving.
|
|
94
|
+
*
|
|
95
|
+
* @param argvs Owning pointer to the command-line arguments vector;
|
|
96
|
+
* the reporter takes ownership via move.
|
|
92
97
|
*/
|
|
93
|
-
|
|
98
|
+
reporter_tap (std::unique_ptr<std::vector<std::string_view>> argvs);
|
|
94
99
|
|
|
95
100
|
/**
|
|
96
101
|
* @brief Deleted copy constructor to prevent copying.
|
|
97
102
|
*/
|
|
98
|
-
|
|
103
|
+
reporter_tap (const reporter_tap&) = delete;
|
|
99
104
|
|
|
100
105
|
/**
|
|
101
106
|
* @brief Deleted move constructor to prevent moving.
|
|
102
107
|
*/
|
|
103
|
-
|
|
108
|
+
reporter_tap (reporter_tap&&) = delete;
|
|
104
109
|
|
|
105
110
|
/**
|
|
106
111
|
* @brief Deleted copy assignment operator to prevent copying.
|
|
107
112
|
*/
|
|
108
|
-
|
|
109
|
-
operator= (const
|
|
110
|
-
= delete;
|
|
113
|
+
reporter_tap&
|
|
114
|
+
operator= (const reporter_tap&) = delete;
|
|
111
115
|
|
|
112
116
|
/**
|
|
113
117
|
* @brief Deleted move assignment operator to prevent moving.
|
|
114
118
|
*/
|
|
115
|
-
|
|
116
|
-
operator= (
|
|
117
|
-
= delete;
|
|
119
|
+
reporter_tap&
|
|
120
|
+
operator= (reporter_tap&&) = delete;
|
|
118
121
|
|
|
119
122
|
/**
|
|
120
|
-
* @brief Destructor for the
|
|
123
|
+
* @brief Destructor for the reporter_tap class.
|
|
121
124
|
*/
|
|
122
|
-
~
|
|
125
|
+
~reporter_tap () override;
|
|
126
|
+
|
|
127
|
+
// ------------------------------------------------------------------------
|
|
123
128
|
|
|
124
129
|
/**
|
|
125
|
-
* @brief
|
|
130
|
+
* @brief Output operator for the `indent_t` manipulator.
|
|
126
131
|
*
|
|
127
|
-
* @
|
|
128
|
-
*
|
|
129
|
-
* @par Returns
|
|
130
|
-
* Nothing.
|
|
132
|
+
* @param m The indentation manipulator produced by `indent(n)`.
|
|
133
|
+
* @return Reference to the current reporter instance.
|
|
131
134
|
*/
|
|
132
|
-
|
|
133
|
-
|
|
135
|
+
reporter_tap&
|
|
136
|
+
operator<< (indent_t m);
|
|
137
|
+
|
|
138
|
+
// Bring base class operator<< overloads into scope to prevent name hiding.
|
|
139
|
+
using reporter::operator<<;
|
|
140
|
+
|
|
141
|
+
// ------------------------------------------------------------------------
|
|
134
142
|
|
|
135
143
|
/**
|
|
136
|
-
* @brief Mark the beginning of a test
|
|
144
|
+
* @brief Mark the beginning of a test session.
|
|
137
145
|
*
|
|
138
|
-
* @param
|
|
146
|
+
* @param runner Reference to the test runner.
|
|
139
147
|
* @par Returns
|
|
140
148
|
* Nothing.
|
|
141
149
|
*/
|
|
142
150
|
void
|
|
143
|
-
|
|
151
|
+
begin_session (runner& runner) override;
|
|
144
152
|
|
|
145
153
|
/**
|
|
146
|
-
* @brief Mark the end of a test
|
|
154
|
+
* @brief Mark the end of a test session.
|
|
147
155
|
*
|
|
148
|
-
* @param
|
|
156
|
+
* @param runner Reference to the test runner.
|
|
149
157
|
* @par Returns
|
|
150
158
|
* Nothing.
|
|
151
159
|
*/
|
|
152
160
|
void
|
|
153
|
-
|
|
161
|
+
end_session (runner& runner) override;
|
|
154
162
|
|
|
155
163
|
/**
|
|
156
164
|
* @brief Mark the beginning of a test suite.
|
|
157
165
|
*
|
|
158
|
-
* @param
|
|
166
|
+
* @param suite Reference to the test suite.
|
|
159
167
|
* @par Returns
|
|
160
168
|
* Nothing.
|
|
161
169
|
*/
|
|
162
|
-
void
|
|
163
|
-
|
|
170
|
+
virtual void
|
|
171
|
+
begin_suite (suite& suite) override;
|
|
164
172
|
|
|
165
173
|
/**
|
|
166
174
|
* @brief Mark the end of a test suite.
|
|
167
175
|
*
|
|
168
|
-
* @param suite Reference to the test suite
|
|
176
|
+
* @param suite Reference to the test suite.
|
|
169
177
|
* @par Returns
|
|
170
178
|
* Nothing.
|
|
171
179
|
*/
|
|
172
|
-
void
|
|
173
|
-
|
|
180
|
+
virtual void
|
|
181
|
+
end_suite (suite& suite) override;
|
|
174
182
|
|
|
175
183
|
/**
|
|
176
|
-
* @brief Mark the beginning of a
|
|
184
|
+
* @brief Mark the beginning of a subtest.
|
|
177
185
|
*
|
|
178
|
-
* @param
|
|
186
|
+
* @param subtest Reference to the subtest.
|
|
179
187
|
* @par Returns
|
|
180
188
|
* Nothing.
|
|
181
189
|
*/
|
|
182
|
-
void
|
|
183
|
-
|
|
190
|
+
virtual void
|
|
191
|
+
begin_subtest (subtest& subtest) override;
|
|
184
192
|
|
|
185
193
|
/**
|
|
186
|
-
* @brief Mark the end of a
|
|
194
|
+
* @brief Mark the end of a subtest.
|
|
187
195
|
*
|
|
188
|
-
* @param
|
|
196
|
+
* @param subtest Reference to the subtest.
|
|
189
197
|
* @par Returns
|
|
190
198
|
* Nothing.
|
|
191
199
|
*/
|
|
192
|
-
void
|
|
193
|
-
|
|
200
|
+
virtual void
|
|
201
|
+
end_subtest (subtest& subtest) override;
|
|
194
202
|
|
|
195
203
|
/**
|
|
196
|
-
* @brief
|
|
204
|
+
* @brief Returns the TAP comment prefix string `"# "`.
|
|
197
205
|
*
|
|
198
206
|
* @par Parameters
|
|
199
207
|
* None.
|
|
200
|
-
* @
|
|
201
|
-
*
|
|
208
|
+
* @return The string `"# "`, used to prefix comment lines in TAP
|
|
209
|
+
* output.
|
|
202
210
|
*/
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
/**
|
|
207
|
-
* @brief Output the current buffered content.
|
|
208
|
-
*
|
|
209
|
-
* @par Parameters
|
|
210
|
-
* None.
|
|
211
|
-
* @par Returns
|
|
212
|
-
* Nothing.
|
|
213
|
-
*/
|
|
214
|
-
void
|
|
215
|
-
output (void) override;
|
|
211
|
+
virtual const char*
|
|
212
|
+
get_comment_prefix (void) override;
|
|
216
213
|
|
|
217
214
|
protected:
|
|
218
215
|
/**
|
|
219
216
|
* @brief Outputs the prefix for a passing condition.
|
|
220
217
|
*
|
|
221
218
|
* @param message The message to display.
|
|
219
|
+
* @param subtest The subtest that owns this check.
|
|
222
220
|
* @par Returns
|
|
223
221
|
* Nothing.
|
|
224
222
|
*/
|
|
225
223
|
void
|
|
226
|
-
output_pass_prefix_ (std::string& message) override;
|
|
224
|
+
output_pass_prefix_ (std::string& message, subtest& subtest) override;
|
|
227
225
|
|
|
228
226
|
/**
|
|
229
227
|
* @brief Outputs the suffix for a passing condition.
|
|
230
228
|
*
|
|
231
|
-
* @
|
|
232
|
-
* None.
|
|
229
|
+
* @param subtest The subtest that owns this check.
|
|
233
230
|
* @par Returns
|
|
234
231
|
* Nothing.
|
|
235
232
|
*/
|
|
236
233
|
void
|
|
237
|
-
output_pass_suffix_ (
|
|
234
|
+
output_pass_suffix_ (subtest& subtest) override;
|
|
238
235
|
|
|
239
236
|
/**
|
|
240
237
|
* @brief Outputs the prefix for a failing condition.
|
|
@@ -243,24 +240,27 @@ namespace micro_os_plus::micro_test_plus
|
|
|
243
240
|
* @param hasExpression Whether the failure is associated with an
|
|
244
241
|
* expression.
|
|
245
242
|
* @param location The source location of the failure.
|
|
243
|
+
* @param subtest The subtest that owns this check.
|
|
246
244
|
* @par Returns
|
|
247
245
|
* Nothing.
|
|
248
246
|
*/
|
|
249
247
|
void
|
|
250
248
|
output_fail_prefix_ (std::string& message, const bool hasExpression,
|
|
251
|
-
const reflection::source_location& location
|
|
249
|
+
const reflection::source_location& location,
|
|
250
|
+
subtest& subtest) override;
|
|
252
251
|
|
|
253
252
|
/**
|
|
254
253
|
* @brief Outputs the suffix for a failing condition.
|
|
255
254
|
*
|
|
256
255
|
* @param location The source location of the failure.
|
|
257
256
|
* @param abort Whether to abort execution after failure.
|
|
257
|
+
* @param subtest The subtest that owns this check.
|
|
258
258
|
* @par Returns
|
|
259
259
|
* Nothing.
|
|
260
260
|
*/
|
|
261
261
|
void
|
|
262
262
|
output_fail_suffix_ (const reflection::source_location& location,
|
|
263
|
-
bool abort) override;
|
|
263
|
+
bool abort, subtest& subtest) override;
|
|
264
264
|
};
|
|
265
265
|
|
|
266
266
|
// --------------------------------------------------------------------------
|