@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.
Files changed (51) hide show
  1. package/CHANGELOG.md +82 -0
  2. package/CMakeLists.txt +74 -24
  3. package/README.md +3 -2
  4. package/include/micro-os-plus/micro-test-plus/README.md +6 -0
  5. package/include/micro-os-plus/micro-test-plus/deferred-reporter.h +29 -54
  6. package/include/micro-os-plus/micro-test-plus/detail.h +166 -705
  7. package/include/micro-os-plus/micro-test-plus/exceptions.h +5 -6
  8. package/include/micro-os-plus/micro-test-plus/expression-formatter.h +669 -0
  9. package/include/micro-os-plus/micro-test-plus/function-comparators.h +5 -0
  10. package/include/micro-os-plus/micro-test-plus/inlines/deferred-reporter-inlines.h +25 -30
  11. package/include/micro-os-plus/micro-test-plus/inlines/detail-inlines.h +711 -0
  12. package/include/micro-os-plus/micro-test-plus/inlines/exceptions-inline.h +137 -0
  13. package/include/micro-os-plus/micro-test-plus/inlines/expression-formatter-inlines.h +510 -0
  14. package/include/micro-os-plus/micro-test-plus/inlines/function-comparators-inlines.h +17 -76
  15. package/include/micro-os-plus/micro-test-plus/inlines/literals-inlines.h +47 -25
  16. package/include/micro-os-plus/micro-test-plus/inlines/math-inlines.h +7 -7
  17. package/include/micro-os-plus/micro-test-plus/inlines/operators-inlines.h +275 -0
  18. package/include/micro-os-plus/micro-test-plus/inlines/reflection-inlines.h +4 -4
  19. package/include/micro-os-plus/micro-test-plus/inlines/reporter-inlines.h +53 -394
  20. package/include/micro-os-plus/micro-test-plus/inlines/runner-inlines.h +38 -0
  21. package/include/micro-os-plus/micro-test-plus/inlines/runner-totals-inlines.h +152 -0
  22. package/include/micro-os-plus/micro-test-plus/inlines/test-inlines.h +231 -45
  23. package/include/micro-os-plus/micro-test-plus/inlines/timings-inlines.h +120 -0
  24. package/include/micro-os-plus/micro-test-plus/inlines/type-traits-inlines.h +231 -0
  25. package/include/micro-os-plus/micro-test-plus/literals.h +8 -14
  26. package/include/micro-os-plus/micro-test-plus/math.h +5 -0
  27. package/include/micro-os-plus/micro-test-plus/operators.h +19 -169
  28. package/include/micro-os-plus/micro-test-plus/reflection.h +5 -12
  29. package/include/micro-os-plus/micro-test-plus/reporter-human.h +17 -11
  30. package/include/micro-os-plus/micro-test-plus/reporter-tap.h +14 -8
  31. package/include/micro-os-plus/micro-test-plus/reporter.h +101 -424
  32. package/include/micro-os-plus/micro-test-plus/runner-totals.h +162 -176
  33. package/include/micro-os-plus/micro-test-plus/runner.h +61 -42
  34. package/include/micro-os-plus/micro-test-plus/test.h +450 -506
  35. package/include/micro-os-plus/micro-test-plus/timings.h +259 -262
  36. package/include/micro-os-plus/micro-test-plus/type-traits.h +19 -67
  37. package/include/micro-os-plus/micro-test-plus/utility.h +5 -4
  38. package/include/micro-os-plus/micro-test-plus.h +33 -24
  39. package/meson.build +1 -0
  40. package/package.json +11 -3
  41. package/src/deferred-reporter.cpp +21 -2
  42. package/src/expression-formatter.cpp +289 -0
  43. package/src/reflection.cpp +3 -1
  44. package/src/reporter-human.cpp +31 -37
  45. package/src/reporter-tap.cpp +25 -35
  46. package/src/reporter.cpp +36 -231
  47. package/src/runner-totals.cpp +6 -3
  48. package/src/runner.cpp +131 -25
  49. package/src/test.cpp +120 -113
  50. package/src/timings.cpp +6 -5
  51. package/src/utility.cpp +1 -1
package/src/runner.cpp CHANGED
@@ -38,13 +38,21 @@
38
38
 
39
39
  // ----------------------------------------------------------------------------
40
40
 
41
+ #include <algorithm>
42
+ #include <string>
43
+
41
44
  #if defined(MICRO_OS_PLUS_INCLUDE_CONFIG_H)
42
45
  #include <micro-os-plus/config.h>
43
46
  #endif // MICRO_OS_PLUS_INCLUDE_CONFIG_H
44
47
 
45
- #include <micro-os-plus/micro-test-plus.h>
48
+ #if defined(MICRO_OS_PLUS_TRACE)
46
49
  #include <micro-os-plus/diag/trace.h>
47
- #include <algorithm>
50
+ #endif // MICRO_OS_PLUS_TRACE
51
+
52
+ #include "micro-os-plus/micro-test-plus/runner.h"
53
+ #include "micro-os-plus/micro-test-plus/utility.h"
54
+ #include "micro-os-plus/micro-test-plus/reporter-tap.h"
55
+ #include "micro-os-plus/micro-test-plus/reporter-human.h"
48
56
 
49
57
  // ----------------------------------------------------------------------------
50
58
 
@@ -65,12 +73,59 @@ namespace micro_os_plus::micro_test_plus
65
73
 
66
74
  /**
67
75
  * @details
68
- * The constructor initialises a new instance of the `test_runner` class,
69
- * preparing the test runner for managing test suites and cases within the
70
- * µTest++ framework. If tracing is enabled, it outputs the function
71
- * signature for diagnostic purposes. This setup ensures the test runner is
72
- * ready to coordinate the registration, execution, and reporting of tests
73
- * across all test cases and folders.
76
+ * Performs the `static_runner` to `runner` upcast where both types are
77
+ * complete, allowing headers with only forward declarations to request this
78
+ * conversion safely.
79
+ */
80
+ runner&
81
+ detail::to_runner (static_runner& static_runner_ref) noexcept
82
+ {
83
+ return static_cast<runner&> (static_runner_ref);
84
+ }
85
+
86
+ /**
87
+ * @details
88
+ * Performs static-suite registration where `static_runner` is complete,
89
+ * allowing header-only template code to avoid direct dependence on
90
+ * `runner.h` include order.
91
+ */
92
+ void
93
+ detail::register_static_suite (static_runner& static_runner_ref,
94
+ static_suite& static_suite_ref)
95
+ {
96
+ static_runner::register_static_suite (static_runner_ref, static_suite_ref);
97
+ }
98
+
99
+ // --------------------------------------------------------------------------
100
+
101
+ /**
102
+ * @details
103
+ * The constructor initialises a new `runner` instance together with
104
+ * its top suite (`top_suite_`). If tracing is enabled, it outputs the
105
+ * function signature for diagnostic purposes.
106
+ */
107
+ runner::runner (void) : test_node{ "runner" }, top_suite_{ "", *this }
108
+ {
109
+ #if defined(MICRO_OS_PLUS_TRACE) \
110
+ && defined(MICRO_OS_PLUS_TRACE_MICRO_TEST_PLUS_CONSTRUCTORS)
111
+ #if defined(__GNUC__)
112
+ #pragma GCC diagnostic push
113
+ #if defined(__clang__)
114
+ #pragma clang diagnostic ignored "-Wunsafe-buffer-usage-in-libc-call"
115
+ #endif
116
+ #endif
117
+ trace::printf ("%s '%s'\n", __PRETTY_FUNCTION__, name ());
118
+ #if defined(__GNUC__)
119
+ #pragma GCC diagnostic pop
120
+ #endif
121
+ #endif // MICRO_OS_PLUS_TRACE_MICRO_TEST_PLUS_CONSTRUCTORS
122
+ }
123
+
124
+ /**
125
+ * @details
126
+ * The constructor initialises a new `runner` instance together with
127
+ * its top suite (`top_suite_`). If tracing is enabled, it outputs the
128
+ * function signature for diagnostic purposes.
74
129
  */
75
130
  runner::runner (const char* top_suite_name)
76
131
  : test_node{ "runner" }, top_suite_{ top_suite_name, *this }
@@ -113,18 +168,18 @@ namespace micro_os_plus::micro_test_plus
113
168
  #endif
114
169
  /**
115
170
  * @details
116
- * This method initialises the test runner by capturing the command-line
117
- * arguments and the default test suite name, configuring the framework for
118
- * subsequent test execution. It parses the arguments to determine the
119
- * desired verbosity level (normal, verbose, quiet, or silent) and applies
120
- * this setting to the test reporter. The method also outputs build and
121
- * environment information when appropriate, aiding diagnostics and
122
- * transparency. Finally, it creates and registers the default test suite,
123
- * preparing the framework to manage and execute all test cases and suites
124
- * across the project’s folders.
171
+ * Captures command-line arguments, selects the reporter implementation
172
+ * (`human` or `tap`), starts session timing, and emits the initial
173
+ * reporter notifications for the session and top suite.
174
+ *
175
+ * If the top suite name is not provided, it attempts to derive a name from
176
+ * `argv[0]` or defaults to "default suite".
177
+ *
178
+ * If tracing is enabled, the command-line arguments are
179
+ * also logged for diagnostic purposes.
125
180
  */
126
181
  suite&
127
- runner::initialise (int argc, char* argv[])
182
+ runner::initialise (int argc, char* argv[], const char* top_suite_name)
128
183
  {
129
184
  #if defined(MICRO_OS_PLUS_TRACE) \
130
185
  && defined(MICRO_OS_PLUS_TRACE_MICRO_TEST_PLUS)
@@ -146,6 +201,38 @@ namespace micro_os_plus::micro_test_plus
146
201
  #endif // defined(MICRO_OS_PLUS_DEBUG)
147
202
  #endif // !defined(MICRO_OS_PLUS_INCLUDE_STARTUP)
148
203
 
204
+ if (strlen (top_suite_name) > 0)
205
+ {
206
+ // If provided by this call, use it, possibly override the
207
+ // deprecated constructor.
208
+ top_suite_name_ = top_suite_name;
209
+ top_suite_.name (top_suite_name_.c_str ());
210
+ }
211
+ else if (strlen (top_suite_.name ()) == 0)
212
+ {
213
+ // If not provided by the constructor or by this call, try to extract a
214
+ // name from argv[0], which is commonly the executable name. If that
215
+ // fails, use a default name.
216
+ if (argc > 0 && argv != nullptr && argv[0] != nullptr)
217
+ {
218
+ std::string_view top_suite_name_view{ utility::extract_file_name (
219
+ argv[0]) };
220
+
221
+ const auto dot_pos = top_suite_name_view.rfind ('.');
222
+ if (dot_pos != std::string_view::npos)
223
+ {
224
+ top_suite_name_view = top_suite_name_view.substr (0, dot_pos);
225
+ }
226
+
227
+ top_suite_name_ = top_suite_name_view;
228
+ }
229
+ else
230
+ {
231
+ top_suite_name_ = "default suite";
232
+ }
233
+ top_suite_.name (top_suite_name_.c_str ());
234
+ }
235
+
149
236
  std::vector<std::string_view> argvs (argv, argv + argc);
150
237
 
151
238
  std::string_view reporter_name{ "tap" };
@@ -277,7 +364,7 @@ namespace micro_os_plus::micro_test_plus
277
364
  // Run the child suite immediately.
278
365
  suite_ptr->run ();
279
366
 
280
- // Accumulate the totals from the static suite into the runner
367
+ // Accumulate the totals from the child suite into the runner
281
368
  // totals.
282
369
  // DO NOT increment executed_subtests here.
283
370
  totals_ += suite_ptr->totals ();
@@ -337,12 +424,8 @@ namespace micro_os_plus::micro_test_plus
337
424
 
338
425
  /**
339
426
  * @details
340
- * This method immediately terminates the process by invoking the standard C
341
- * library `abort()` function. It is used to halt test execution in critical
342
- * failure scenarios, ensuring that no further tests are run and that the
343
- * cause of the failure can be promptly investigated. This approach provides
344
- * a robust mechanism for enforcing strict test outcomes across all test
345
- * cases and folders.
427
+ * Prints the source location of the fatal error to `stderr` and then
428
+ * terminates the process via `::abort()`.
346
429
  */
347
430
  void
348
431
  runner::abort (const reflection::source_location& sl)
@@ -391,6 +474,29 @@ namespace micro_os_plus::micro_test_plus
391
474
 
392
475
  // ==========================================================================
393
476
 
477
+ /**
478
+ * @details
479
+ * Delegates construction to the `runner` base class.
480
+ * If tracing is enabled, the function signature
481
+ * and suite name are output for diagnostic purposes.
482
+ */
483
+ static_runner::static_runner (void) : runner{}
484
+ {
485
+ #if defined(MICRO_OS_PLUS_TRACE) \
486
+ && defined(MICRO_OS_PLUS_TRACE_MICRO_TEST_PLUS_CONSTRUCTORS)
487
+ #if defined(__GNUC__)
488
+ #pragma GCC diagnostic push
489
+ #if defined(__clang__)
490
+ #pragma clang diagnostic ignored "-Wunsafe-buffer-usage-in-libc-call"
491
+ #endif
492
+ #endif
493
+ trace::printf ("%s '%s'\n", __PRETTY_FUNCTION__, name ());
494
+ #if defined(__GNUC__)
495
+ #pragma GCC diagnostic pop
496
+ #endif
497
+ #endif // MICRO_OS_PLUS_TRACE_MICRO_TEST_PLUS_CONSTRUCTORS
498
+ }
499
+
394
500
  /**
395
501
  * @details
396
502
  * Delegates construction to the `runner` base class with the given
package/src/test.cpp CHANGED
@@ -47,8 +47,12 @@
47
47
  #include <micro-os-plus/config.h>
48
48
  #endif // MICRO_OS_PLUS_INCLUDE_CONFIG_H
49
49
 
50
- #include <micro-os-plus/micro-test-plus.h>
50
+ #if defined(MICRO_OS_PLUS_TRACE)
51
51
  #include <micro-os-plus/diag/trace.h>
52
+ #endif // MICRO_OS_PLUS_TRACE
53
+
54
+ #include "micro-os-plus/micro-test-plus/test.h"
55
+ #include "micro-os-plus/micro-test-plus/runner.h"
52
56
 
53
57
  // ----------------------------------------------------------------------------
54
58
 
@@ -63,20 +67,22 @@
63
67
  #endif
64
68
  #endif
65
69
 
66
- // ==========================================================================
70
+ // ============================================================================
67
71
 
68
72
  namespace micro_os_plus::micro_test_plus
69
73
  {
70
- // ==========================================================================
71
-
72
- /**
73
- * @details
74
- * Stores the supplied @p name pointer, which is expected to point to
75
- * a string with a lifetime exceeding that of this instance. If
76
- * tracing is enabled, the name is output for diagnostic purposes.
77
- */
78
- test_node::test_node (const char* name) : name_{ name }
74
+ namespace detail
79
75
  {
76
+ // ========================================================================
77
+
78
+ /**
79
+ * @details
80
+ * Stores the supplied @p name pointer, which is expected to point to
81
+ * a string with a lifetime exceeding that of this instance. If
82
+ * tracing is enabled, the name is output for diagnostic purposes.
83
+ */
84
+ test_node::test_node (const char* name) : name_{ name }
85
+ {
80
86
  #if defined(MICRO_OS_PLUS_TRACE) \
81
87
  && defined(MICRO_OS_PLUS_TRACE_MICRO_TEST_PLUS_CONSTRUCTORS)
82
88
  #if defined(__GNUC__)
@@ -85,21 +91,21 @@ namespace micro_os_plus::micro_test_plus
85
91
  #pragma clang diagnostic ignored "-Wunsafe-buffer-usage-in-libc-call"
86
92
  #endif
87
93
  #endif
88
- trace::printf ("%s '%s'\n", __PRETTY_FUNCTION__, name);
94
+ trace::printf ("%s '%s'\n", __PRETTY_FUNCTION__, name);
89
95
  #if defined(__GNUC__)
90
96
  #pragma GCC diagnostic pop
91
97
  #endif
92
98
  #endif // MICRO_OS_PLUS_TRACE_MICRO_TEST_PLUS_CONSTRUCTORS
93
- }
94
-
95
- /**
96
- * @details
97
- * No resources are owned by `test_node`; the destructor performs no
98
- * explicit clean-up. If tracing is enabled, the node name is output
99
- * for diagnostic purposes.
100
- */
101
- test_node::~test_node ()
102
- {
99
+ }
100
+
101
+ /**
102
+ * @details
103
+ * No resources are owned by `test_node`; the destructor performs no
104
+ * explicit clean-up. If tracing is enabled, the node name is output
105
+ * for diagnostic purposes.
106
+ */
107
+ test_node::~test_node ()
108
+ {
103
109
  #if defined(MICRO_OS_PLUS_TRACE) \
104
110
  && defined(MICRO_OS_PLUS_TRACE_MICRO_TEST_PLUS_CONSTRUCTORS)
105
111
  #if defined(__GNUC__)
@@ -108,29 +114,29 @@ namespace micro_os_plus::micro_test_plus
108
114
  #pragma clang diagnostic ignored "-Wunsafe-buffer-usage-in-libc-call"
109
115
  #endif
110
116
  #endif
111
- trace::printf ("%s '%s'\n", __PRETTY_FUNCTION__, name_);
117
+ trace::printf ("%s '%s'\n", __PRETTY_FUNCTION__, name_);
112
118
  #if defined(__GNUC__)
113
119
  #pragma GCC diagnostic pop
114
120
  #endif
115
121
  #endif // MICRO_OS_PLUS_TRACE_MICRO_TEST_PLUS_CONSTRUCTORS
116
- }
117
-
118
- // ==========================================================================
119
-
120
- /**
121
- * @details
122
- * The constructor initialises a new instance of the `runnable_base` class
123
- * with the specified name. It sets up the internal state required for
124
- * managing test cases within the suite. If tracing is enabled, the function
125
- * signature is output for diagnostic purposes. The default test suite does
126
- * not require explicit registration, ensuring seamless integration within
127
- * the µTest++ framework and supporting organised test management across all
128
- * files and folders.
129
- */
130
- runnable_base::runnable_base (const char* name, class runner& runner,
131
- size_t own_index)
132
- : test_node{ name }, runner_{ runner }, own_index_{ own_index }
133
- {
122
+ }
123
+
124
+ // ========================================================================
125
+
126
+ /**
127
+ * @details
128
+ * The constructor initialises a new instance of the `runnable_base` class
129
+ * with the specified name. It sets up the internal state required for
130
+ * managing test cases within the suite. If tracing is enabled, the
131
+ * function signature is output for diagnostic purposes. The default test
132
+ * suite does not require explicit registration, ensuring seamless
133
+ * integration within the µTest++ framework and supporting organised test
134
+ * management across all files and folders.
135
+ */
136
+ runnable_base::runnable_base (const char* name, class runner& runner,
137
+ size_t own_index)
138
+ : test_node{ name }, runner_{ runner }, own_index_{ own_index }
139
+ {
134
140
  #if defined(MICRO_OS_PLUS_TRACE) \
135
141
  && defined(MICRO_OS_PLUS_TRACE_MICRO_TEST_PLUS_CONSTRUCTORS)
136
142
  #if defined(__GNUC__)
@@ -139,22 +145,22 @@ namespace micro_os_plus::micro_test_plus
139
145
  #pragma clang diagnostic ignored "-Wunsafe-buffer-usage-in-libc-call"
140
146
  #endif
141
147
  #endif
142
- trace::printf ("%s '%s' %zu\n", __PRETTY_FUNCTION__, name, own_index_);
148
+ trace::printf ("%s '%s' %zu\n", __PRETTY_FUNCTION__, name, own_index_);
143
149
  #if defined(__GNUC__)
144
150
  #pragma GCC diagnostic pop
145
151
  #endif
146
152
  #endif // MICRO_OS_PLUS_TRACE_MICRO_TEST_PLUS_CONSTRUCTORS
147
- }
148
-
149
- /**
150
- * @details
151
- * The destructor releases any resources associated with the
152
- * `runnable_base` instance. It ensures that the test suite is properly
153
- * cleaned up after execution, supporting robust and reliable test management
154
- * across all files and folders within the µTest++ framework.
155
- */
156
- runnable_base::~runnable_base ()
157
- {
153
+ }
154
+
155
+ /**
156
+ * @details
157
+ * The destructor releases any resources associated with the
158
+ * `runnable_base` instance. It ensures that the test suite is properly
159
+ * cleaned up after execution, supporting robust and reliable test
160
+ * management across all files and folders within the µTest++ framework.
161
+ */
162
+ runnable_base::~runnable_base ()
163
+ {
158
164
  #if defined(MICRO_OS_PLUS_TRACE) \
159
165
  && defined(MICRO_OS_PLUS_TRACE_MICRO_TEST_PLUS_CONSTRUCTORS)
160
166
  #if defined(__GNUC__)
@@ -163,60 +169,60 @@ namespace micro_os_plus::micro_test_plus
163
169
  #pragma clang diagnostic ignored "-Wunsafe-buffer-usage-in-libc-call"
164
170
  #endif
165
171
  #endif
166
- trace::printf ("%s '%s'\n", __PRETTY_FUNCTION__, name_);
172
+ trace::printf ("%s '%s'\n", __PRETTY_FUNCTION__, name_);
167
173
  #if defined(__GNUC__)
168
174
  #pragma GCC diagnostic pop
169
175
  #endif
170
176
  #endif // MICRO_OS_PLUS_TRACE_MICRO_TEST_PLUS_CONSTRUCTORS
171
177
 
172
- // children_subtests_ holds unique_ptrs; destroyed automatically.
173
- }
174
-
175
- /**
176
- * @details
177
- * Delegates immediately to `runner_.reporter()`, returning the
178
- * reporter associated with the owning runner instance.
179
- */
180
- [[nodiscard]] reporter&
181
- runnable_base::reporter (void) const noexcept
182
- {
183
- return runner_.reporter ();
184
- }
185
-
186
- /**
187
- * @details
188
- * Delegates immediately to `runner_.abort()`, passing the supplied
189
- * source location so that the error message identifies the call site
190
- * before the process is terminated via `::abort()`.
191
- */
192
- [[noreturn]] void
193
- runnable_base::abort (const reflection::source_location& sl)
194
- {
195
- runner_.abort (sl);
196
- }
197
-
198
- /**
199
- * @details
200
- * Transfers ownership of @p child_test into `children_subtests_` and
201
- * immediately invokes `subtest::run()` on the newly stored subtest.
202
- * The parent's executed-subtest counter is then incremented. The
203
- * child's check counters are intentionally not merged into the parent
204
- * totals; each subtest reports only its own counters. The child's
205
- * totals are, however, accumulated into @p suite so that the suite
206
- * summary reflects all checks performed by its subtests.
207
- */
208
- void
209
- runnable_base::after_subtest_create_ (
210
- std::unique_ptr<class subtest> child_test, suite& suite)
211
- {
212
- // Transfer ownership into the vector.
213
- children_subtests_.push_back (std::move (child_test));
214
-
215
- // Run the child test case immediately.
216
- class subtest& subtest = *children_subtests_.back ();
217
- subtest.run ();
218
-
219
- // This test executed one more subtest.
178
+ // children_subtests_ holds unique_ptrs; destroyed automatically.
179
+ }
180
+
181
+ /**
182
+ * @details
183
+ * Delegates immediately to `runner_.reporter()`, returning the
184
+ * reporter associated with the owning runner instance.
185
+ */
186
+ [[nodiscard]] reporter&
187
+ runnable_base::reporter (void) const noexcept
188
+ {
189
+ return runner_.reporter ();
190
+ }
191
+
192
+ /**
193
+ * @details
194
+ * Delegates immediately to `runner_.abort()`, passing the supplied
195
+ * source location so that the error message identifies the call site
196
+ * before the process is terminated via `::abort()`.
197
+ */
198
+ [[noreturn]] void
199
+ runnable_base::abort (const reflection::source_location& sl)
200
+ {
201
+ runner_.abort (sl);
202
+ }
203
+
204
+ /**
205
+ * @details
206
+ * Transfers ownership of @p child_test into `children_subtests_` and
207
+ * immediately invokes `subtest::run()` on the newly stored subtest.
208
+ * The parent's executed-subtest counter is then incremented. The
209
+ * child's check counters are intentionally not merged into the parent
210
+ * totals; each subtest reports only its own counters. The child's
211
+ * totals are, however, accumulated into @p suite so that the suite
212
+ * summary reflects all checks performed by its subtests.
213
+ */
214
+ void
215
+ runnable_base::after_subtest_create_ (
216
+ std::unique_ptr<class subtest> child_test, suite& suite)
217
+ {
218
+ // Transfer ownership into the vector.
219
+ children_subtests_.push_back (std::move (child_test));
220
+
221
+ // Run the child test case immediately.
222
+ class subtest& subtest = *children_subtests_.back ();
223
+ subtest.run ();
224
+
225
+ // This test executed one more subtest.
220
226
  #if defined(MICRO_OS_PLUS_TRACE) \
221
227
  && defined(MICRO_OS_PLUS_TRACE_MICRO_TEST_PLUS_CONSTRUCTORS)
222
228
  #if defined(__GNUC__)
@@ -225,15 +231,15 @@ namespace micro_os_plus::micro_test_plus
225
231
  #pragma clang diagnostic ignored "-Wunsafe-buffer-usage-in-libc-call"
226
232
  #endif
227
233
  #endif
228
- trace::printf ("%s subtest '%s' executed one more subtest\n",
229
- __PRETTY_FUNCTION__, name ());
234
+ trace::printf ("%s subtest '%s' executed one more subtest\n",
235
+ __PRETTY_FUNCTION__, name ());
230
236
  #if defined(__GNUC__)
231
237
  #pragma GCC diagnostic pop
232
238
  #endif
233
239
  #endif // MICRO_OS_PLUS_TRACE_MICRO_TEST_PLUS_CONSTRUCTORS
234
- totals ().increment_executed_subtests ();
235
- // Do not accumulate the totals from the child test into the current test
236
- // totals, each subtest shows only its counters.
240
+ totals ().increment_executed_subtests ();
241
+ // Do not accumulate the totals from the child test into the current test
242
+ // totals, each subtest shows only its counters.
237
243
 
238
244
  #if defined(MICRO_OS_PLUS_TRACE) \
239
245
  && defined(MICRO_OS_PLUS_TRACE_MICRO_TEST_PLUS_CONSTRUCTORS)
@@ -243,23 +249,24 @@ namespace micro_os_plus::micro_test_plus
243
249
  #pragma clang diagnostic ignored "-Wunsafe-buffer-usage-in-libc-call"
244
250
  #endif
245
251
  #endif
246
- trace::printf ("%s suite '%s' totals\n", __PRETTY_FUNCTION__,
247
- suite.name ());
252
+ trace::printf ("%s suite '%s' totals\n", __PRETTY_FUNCTION__,
253
+ suite.name ());
248
254
  #if defined(__GNUC__)
249
255
  #pragma GCC diagnostic pop
250
256
  #endif
251
257
  #endif // MICRO_OS_PLUS_TRACE_MICRO_TEST_PLUS_CONSTRUCTORS
252
258
 
253
- // Accumulate the totals from the child test into the suite totals.
254
- suite.totals () += subtest.totals ();
255
- }
259
+ // Accumulate the totals from the child test into the suite totals.
260
+ suite.totals () += subtest.totals ();
261
+ }
262
+ } // namespace detail
256
263
 
257
264
  // ==========================================================================
258
265
 
259
266
  /**
260
267
  * @details
261
268
  * The destructor releases any resources associated with the
262
- * `test` instance. If tracing is enabled, it outputs the
269
+ * `subtest` instance. If tracing is enabled, it outputs the
263
270
  * function signature for diagnostic purposes. This ensures that the test
264
271
  * suite is properly cleaned up after execution, supporting robust and
265
272
  * reliable test management across all files and folders within the µTest++
package/src/timings.cpp CHANGED
@@ -35,13 +35,13 @@
35
35
 
36
36
  // ----------------------------------------------------------------------------
37
37
 
38
+ #include <cassert>
39
+
38
40
  #if defined(MICRO_OS_PLUS_INCLUDE_CONFIG_H)
39
41
  #include <micro-os-plus/config.h>
40
42
  #endif // MICRO_OS_PLUS_INCLUDE_CONFIG_H
41
43
 
42
- #include <micro-os-plus/micro-test-plus.h>
43
-
44
- #include <cassert>
44
+ #include "micro-os-plus/micro-test-plus/timings.h"
45
45
 
46
46
  // ----------------------------------------------------------------------------
47
47
 
@@ -56,7 +56,7 @@
56
56
 
57
57
  // ============================================================================
58
58
 
59
- namespace micro_os_plus::micro_test_plus
59
+ namespace micro_os_plus::micro_test_plus::detail
60
60
  {
61
61
  // --------------------------------------------------------------------------
62
62
 
@@ -205,5 +205,6 @@ namespace micro_os_plus::micro_test_plus
205
205
  }
206
206
 
207
207
  // --------------------------------------------------------------------------
208
+ } // namespace micro_os_plus::micro_test_plus::detail
208
209
 
209
- } // namespace micro_os_plus::micro_test_plus
210
+ // ----------------------------------------------------------------------------
package/src/utility.cpp CHANGED
@@ -38,7 +38,7 @@
38
38
  #include <micro-os-plus/config.h>
39
39
  #endif // MICRO_OS_PLUS_INCLUDE_CONFIG_H
40
40
 
41
- #include <micro-os-plus/micro-test-plus.h>
41
+ #include "micro-os-plus/micro-test-plus/utility.h"
42
42
 
43
43
  // ----------------------------------------------------------------------------
44
44