@micro-os-plus/micro-test-plus 3.3.0 → 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.
Files changed (53) hide show
  1. package/CHANGELOG.md +339 -2
  2. package/CMakeLists.txt +79 -23
  3. package/README.md +1 -1
  4. package/config/xcdl-build.json +11 -4
  5. package/include/micro-os-plus/micro-test-plus/deferred-reporter.h +292 -0
  6. package/include/micro-os-plus/micro-test-plus/detail.h +462 -1076
  7. package/include/micro-os-plus/micro-test-plus/exceptions.h +126 -0
  8. package/include/micro-os-plus/micro-test-plus/function-comparators.h +10 -7
  9. package/include/micro-os-plus/micro-test-plus/inlines/{details-inlines.h → deferred-reporter-inlines.h} +49 -22
  10. package/include/micro-os-plus/micro-test-plus/inlines/function-comparators-inlines.h +67 -4
  11. package/include/micro-os-plus/micro-test-plus/inlines/literals-inlines.h +3 -6
  12. package/include/micro-os-plus/micro-test-plus/inlines/math-inlines.h +21 -15
  13. package/include/micro-os-plus/micro-test-plus/inlines/reflection-inlines.h +35 -17
  14. package/include/micro-os-plus/micro-test-plus/inlines/{test-reporter-inlines.h → reporter-inlines.h} +176 -106
  15. package/include/micro-os-plus/micro-test-plus/inlines/{test-suite-inlines.h → runner-inlines.h} +41 -43
  16. package/include/micro-os-plus/micro-test-plus/inlines/test-inlines.h +369 -0
  17. package/include/micro-os-plus/micro-test-plus/inlines/utility-inlines.h +126 -0
  18. package/include/micro-os-plus/micro-test-plus/literals.h +4 -3
  19. package/include/micro-os-plus/micro-test-plus/math.h +9 -6
  20. package/include/micro-os-plus/micro-test-plus/operators.h +38 -44
  21. package/include/micro-os-plus/micro-test-plus/reflection.h +15 -4
  22. package/include/micro-os-plus/micro-test-plus/{test-reporter-basic.h → reporter-human.h} +72 -72
  23. package/include/micro-os-plus/micro-test-plus/{test-reporter-tap.h → reporter-tap.h} +69 -69
  24. package/include/micro-os-plus/micro-test-plus/{test-reporter.h → reporter.h} +296 -200
  25. package/include/micro-os-plus/micro-test-plus/runner-totals.h +264 -0
  26. package/include/micro-os-plus/micro-test-plus/runner.h +453 -0
  27. package/include/micro-os-plus/micro-test-plus/test.h +1069 -0
  28. package/include/micro-os-plus/micro-test-plus/timings.h +366 -0
  29. package/include/micro-os-plus/micro-test-plus/type-traits.h +239 -545
  30. package/include/micro-os-plus/micro-test-plus/utility.h +135 -0
  31. package/include/micro-os-plus/micro-test-plus.h +25 -228
  32. package/meson.build +10 -6
  33. package/package.json +1 -1
  34. package/src/deferred-reporter.cpp +118 -0
  35. package/src/reflection.cpp +95 -0
  36. package/src/reporter-human.cpp +822 -0
  37. package/src/reporter-tap.cpp +782 -0
  38. package/src/reporter.cpp +676 -0
  39. package/src/runner-totals.cpp +95 -0
  40. package/src/runner.cpp +563 -0
  41. package/src/test.cpp +496 -0
  42. package/src/timings.cpp +209 -0
  43. package/src/utility.cpp +163 -0
  44. package/.cmake-format.yaml +0 -11
  45. package/include/micro-os-plus/micro-test-plus/inlines/micro-test-plus-inlines.h +0 -313
  46. package/include/micro-os-plus/micro-test-plus/test-runner.h +0 -281
  47. package/include/micro-os-plus/micro-test-plus/test-suite.h +0 -492
  48. package/src/micro-test-plus.cpp +0 -316
  49. package/src/test-reporter-basic.cpp +0 -466
  50. package/src/test-reporter-tap.cpp +0 -530
  51. package/src/test-reporter.cpp +0 -399
  52. package/src/test-runner.cpp +0 -311
  53. package/src/test-suite.cpp +0 -304
@@ -0,0 +1,264 @@
1
+ /*
2
+ * This file is part of the µOS++ project (https://micro-os-plus.github.io/).
3
+ * Copyright (c) 2021-2026 Liviu Ionescu. All rights reserved.
4
+ *
5
+ * Permission to use, copy, modify, and/or distribute this software for any
6
+ * purpose is hereby granted, under the terms of the MIT license.
7
+ *
8
+ * If a copy of the license was not distributed with this file, it can be
9
+ * obtained from https://opensource.org/licenses/mit.
10
+ *
11
+ * Major parts of the code are inspired from v1.1.8 of the Boost UT project,
12
+ * released under the terms of the Boost Version 1.0 Software License,
13
+ * which can be obtained from https://www.boost.org/LICENSE_1_0.txt.
14
+ */
15
+
16
+ // ----------------------------------------------------------------------------
17
+
18
+ /**
19
+ * @file
20
+ * @brief C++ header file with declarations for the µTest++ runner totals.
21
+ *
22
+ * @details
23
+ * This header provides the `runner_totals` class, which aggregates the
24
+ * counts of successful checks, failed checks, and executed subtests for a
25
+ * test runner, test suite, or subtest. Instances of this class are embedded
26
+ * inside every `test_node`-derived object and updated in place as the
27
+ * test session progresses.
28
+ *
29
+ * All definitions reside within the `micro_os_plus::micro_test_plus`
30
+ * namespace, ensuring clear separation from user code and minimising the
31
+ * risk of naming conflicts.
32
+ *
33
+ * This file is intended solely for internal use within the framework and
34
+ * should not be included directly by user code.
35
+ */
36
+
37
+ #ifndef MICRO_TEST_PLUS_TEST_RUNNER_TOTALS_H_
38
+ #define MICRO_TEST_PLUS_TEST_RUNNER_TOTALS_H_
39
+
40
+ // ----------------------------------------------------------------------------
41
+
42
+ #ifdef __cplusplus
43
+
44
+ // ----------------------------------------------------------------------------
45
+
46
+ #include <cstddef>
47
+
48
+ // ----------------------------------------------------------------------------
49
+
50
+ #if defined(__GNUC__)
51
+ #pragma GCC diagnostic push
52
+ #if defined(__clang__)
53
+ #pragma clang diagnostic ignored "-Wc++98-compat"
54
+ #endif
55
+ #endif
56
+
57
+ // ============================================================================
58
+
59
+ namespace micro_os_plus::micro_test_plus
60
+ {
61
+ // --------------------------------------------------------------------------
62
+
63
+ /**
64
+ * @brief Aggregated pass/fail/subtest counters for a node in the test tree.
65
+ *
66
+ * @details
67
+ * `runner_totals` records three counters that are maintained throughout a
68
+ * test session:
69
+ * - the number of checks that passed (`successful_checks_`),
70
+ * - the number of checks that failed (`failed_checks_`), and
71
+ * - the number of subtests that were executed (`executed_subtests_`).
72
+ *
73
+ * Every `test_node`-derived object (`runner`, `suite`, `subtest`) owns a
74
+ * `runner_totals` member and accumulates its counts in place. At the end
75
+ * of each suite or session the operator `+=` propagates the child totals
76
+ * up to the parent node.
77
+ *
78
+ * The class is non-copyable and non-movable to prevent accidental
79
+ * duplication of live counters.
80
+ *
81
+ * @headerfile micro-test-plus.h <micro-os-plus/micro-test-plus.h>
82
+ */
83
+ class runner_totals
84
+ {
85
+ public:
86
+ /**
87
+ * @brief Default constructor. All counters are zero-initialised.
88
+ */
89
+ runner_totals () = default;
90
+
91
+ /**
92
+ * @brief Deleted copy constructor to prevent copying.
93
+ */
94
+ runner_totals (const runner_totals&) = delete;
95
+
96
+ /**
97
+ * @brief Deleted move constructor to prevent moving.
98
+ */
99
+ runner_totals (runner_totals&&) = delete;
100
+
101
+ /**
102
+ * @brief Deleted copy assignment operator to prevent copying.
103
+ */
104
+ runner_totals&
105
+ operator= (const runner_totals&) = delete;
106
+
107
+ /**
108
+ * @brief Deleted move assignment operator to prevent moving.
109
+ */
110
+ runner_totals&
111
+ operator= (runner_totals&&) = delete;
112
+
113
+ /**
114
+ * @brief Accumulates the totals from another instance into this one.
115
+ *
116
+ * @param other The instance whose totals are to be added.
117
+ * @return Reference to this instance.
118
+ */
119
+ runner_totals&
120
+ operator+= (const runner_totals& other) noexcept;
121
+
122
+ /**
123
+ * @brief Increments the successful-checks counter.
124
+ *
125
+ * @param count The number of successful checks to add (default 1).
126
+ * @par Returns
127
+ * Nothing.
128
+ */
129
+ void
130
+ increment_successful_checks (size_t count = 1) noexcept
131
+ {
132
+ successful_checks_ += count;
133
+ }
134
+
135
+ /**
136
+ * @brief Increments the failed-checks counter.
137
+ *
138
+ * @param count The number of failed checks to add (default 1).
139
+ * @par Returns
140
+ * Nothing.
141
+ */
142
+ void
143
+ increment_failed_checks (size_t count = 1) noexcept
144
+ {
145
+ failed_checks_ += count;
146
+ }
147
+
148
+ /**
149
+ * @brief Increments the executed-subtests counter.
150
+ *
151
+ * @param count The number of subtests to add (default 1).
152
+ * @par Returns
153
+ * Nothing.
154
+ */
155
+ void
156
+ increment_executed_subtests (size_t count = 1) noexcept
157
+ {
158
+ executed_subtests_ += count;
159
+ }
160
+
161
+ /**
162
+ * @brief Returns the number of checks that passed.
163
+ *
164
+ * @par Parameters
165
+ * None.
166
+ * @return The cumulative count of successful checks.
167
+ */
168
+ [[nodiscard]] size_t
169
+ successful_checks () const noexcept
170
+ {
171
+ return successful_checks_;
172
+ }
173
+
174
+ /**
175
+ * @brief Returns the number of checks that failed.
176
+ *
177
+ * @par Parameters
178
+ * None.
179
+ * @return The cumulative count of failed checks.
180
+ */
181
+ [[nodiscard]] size_t
182
+ failed_checks () const noexcept
183
+ {
184
+ return failed_checks_;
185
+ }
186
+
187
+ /**
188
+ * @brief Returns the total number of checks executed.
189
+ *
190
+ * @par Parameters
191
+ * None.
192
+ * @return The sum of successful and failed checks.
193
+ */
194
+ [[nodiscard]] size_t
195
+ executed_checks () const noexcept
196
+ {
197
+ return successful_checks_ + failed_checks_;
198
+ }
199
+
200
+ /**
201
+ * @brief Returns the number of subtests that were executed.
202
+ *
203
+ * @par Parameters
204
+ * None.
205
+ * @return The cumulative count of executed subtests.
206
+ */
207
+ [[nodiscard]] size_t
208
+ executed_subtests () const noexcept
209
+ {
210
+ return executed_subtests_;
211
+ }
212
+
213
+ /**
214
+ * @brief Checks whether all executed checks were successful.
215
+ *
216
+ * @par Parameters
217
+ * None.
218
+ * @retval true No checks failed.
219
+ * @retval false At least one check failed.
220
+ *
221
+ * @details
222
+ * A runner with no checks at all is considered successful, as it
223
+ * did not fail any check.
224
+ */
225
+ [[nodiscard]] bool
226
+ was_successful (void) const noexcept
227
+ {
228
+ return failed_checks_ == 0;
229
+ }
230
+
231
+ protected:
232
+ /**
233
+ * @brief Total number of successful checks.
234
+ */
235
+ size_t successful_checks_ = 0;
236
+
237
+ /**
238
+ * @brief Total number of failed checks.
239
+ */
240
+ size_t failed_checks_ = 0;
241
+
242
+ /**
243
+ * @brief Total number of tests executed.
244
+ */
245
+ size_t executed_subtests_ = 0;
246
+ };
247
+
248
+ // --------------------------------------------------------------------------
249
+
250
+ } // namespace micro_os_plus::micro_test_plus
251
+
252
+ #if defined(__GNUC__)
253
+ #pragma GCC diagnostic pop
254
+ #endif
255
+
256
+ // ----------------------------------------------------------------------------
257
+
258
+ #endif // __cplusplus
259
+
260
+ // ----------------------------------------------------------------------------
261
+
262
+ #endif // MICRO_TEST_PLUS_TEST_RUNNER_TOTALS_H_
263
+
264
+ // ----------------------------------------------------------------------------
@@ -0,0 +1,453 @@
1
+ /*
2
+ * This file is part of the µOS++ project (https://micro-os-plus.github.io/).
3
+ * Copyright (c) 2021-2026 Liviu Ionescu. All rights reserved.
4
+ *
5
+ * Permission to use, copy, modify, and/or distribute this software for any
6
+ * purpose is hereby granted, under the terms of the MIT license.
7
+ *
8
+ * If a copy of the license was not distributed with this file, it can be
9
+ * obtained from https://opensource.org/licenses/mit.
10
+ *
11
+ * Major parts of the code are inspired from v1.1.8 of the Boost UT project,
12
+ * released under the terms of the Boost Version 1.0 Software License,
13
+ * which can be obtained from https://www.boost.org/LICENSE_1_0.txt.
14
+ */
15
+
16
+ // ----------------------------------------------------------------------------
17
+
18
+ /**
19
+ * @file
20
+ * @brief C++ header file with declarations for the µTest++ test runner.
21
+ *
22
+ * @details
23
+ * This header provides the declarations for the test runner facilities used
24
+ * within the µTest++ framework. It defines the interface for managing the
25
+ * registration and execution of test suites, supporting automated discovery
26
+ * and orchestration of tests across a project.
27
+ *
28
+ * The test runner is responsible for initialising the test environment,
29
+ * registering test suites, managing command-line arguments, and determining
30
+ * the overall test result via an exit code. It also provides mechanisms for
31
+ * aborting test execution and retrieving the default suite name.
32
+ *
33
+ * All definitions reside within the
34
+ * `micro_os_plus::micro_test_plus` namespace, ensuring clear
35
+ * separation from user code and minimising the risk of naming conflicts.
36
+ *
37
+ * The header files are organised within the
38
+ * `include/micro-os-plus/micro-test-plus` folder to maintain a structured and
39
+ * modular codebase.
40
+ *
41
+ * This file is intended solely for internal use within the framework and
42
+ * should not be included directly by user code.
43
+ */
44
+
45
+ #ifndef MICRO_TEST_PLUS_TEST_RUNNER_H_
46
+ #define MICRO_TEST_PLUS_TEST_RUNNER_H_
47
+
48
+ // ----------------------------------------------------------------------------
49
+
50
+ #ifdef __cplusplus
51
+
52
+ // ----------------------------------------------------------------------------
53
+
54
+ #include <functional>
55
+ #include <memory>
56
+
57
+ #include "reporter.h"
58
+ #include "timings.h"
59
+ #include "test.h"
60
+
61
+ // ----------------------------------------------------------------------------
62
+
63
+ #if defined(__GNUC__)
64
+ #pragma GCC diagnostic push
65
+ #pragma GCC diagnostic ignored "-Wpadded"
66
+ #if defined(__clang__)
67
+ #pragma clang diagnostic ignored "-Wc++98-compat"
68
+ #else // GCC only
69
+ #pragma GCC diagnostic ignored "-Wsuggest-final-types"
70
+ #pragma GCC diagnostic ignored "-Wsuggest-final-methods"
71
+ #pragma GCC diagnostic ignored "-Wredundant-tags"
72
+ #endif
73
+ #endif
74
+
75
+ // ============================================================================
76
+
77
+ namespace micro_os_plus::micro_test_plus
78
+ {
79
+ // --------------------------------------------------------------------------
80
+
81
+ /**
82
+ * @ingroup micro-test-plus-runners
83
+ * @brief The test runner for the µTest++ framework.
84
+ *
85
+ * @details
86
+ * The `runner` class is responsible for managing the registration and
87
+ * execution of test suites within the µTest++ framework. It maintains a
88
+ * collection of test suites, each of which registers itself automatically
89
+ * upon construction, enabling seamless integration and execution of tests
90
+ * across different components and folders of a project.
91
+ *
92
+ * The test runner provides methods for initialising the test environment,
93
+ * registering test suites, retrieving the runner's name, and determining the
94
+ * overall test result via an exit code. It also offers an abort mechanism
95
+ * for terminating test execution in exceptional circumstances.
96
+ *
97
+ * All members and methods are defined within the
98
+ * `micro_os_plus::micro_test_plus` namespace, ensuring clear separation from
99
+ * user code and minimising the risk of naming conflicts.
100
+ *
101
+ * @headerfile micro-test-plus.h <micro-os-plus/micro-test-plus.h>
102
+ */
103
+ class runner : public test_node
104
+ {
105
+ public:
106
+ /**
107
+ * @brief Default constructor for the runner class.
108
+ *
109
+ * @details
110
+ * The rule of five is enforced to prevent accidental copying or moving.
111
+ */
112
+ runner (const char* top_suite_name);
113
+
114
+ /**
115
+ * @brief Deleted copy constructor to prevent copying.
116
+ */
117
+ runner (const runner&) = delete;
118
+
119
+ /**
120
+ * @brief Deleted move constructor to prevent moving.
121
+ */
122
+ runner (runner&&) = delete;
123
+
124
+ /**
125
+ * @brief Deleted copy assignment operator to prevent copying.
126
+ */
127
+ runner&
128
+ operator= (const runner&) = delete;
129
+
130
+ /**
131
+ * @brief Deleted move assignment operator to prevent moving.
132
+ */
133
+ runner&
134
+ operator= (runner&&) = delete;
135
+
136
+ /**
137
+ * @brief Destructor for the runner class.
138
+ */
139
+ virtual ~runner () override;
140
+
141
+ /**
142
+ * @brief Initialises the test runner with command-line arguments.
143
+ *
144
+ * @param argc The argument count from main().
145
+ * @param argv The argument vector from main().
146
+ * @return Reference to the top-level test suite.
147
+ */
148
+ class suite&
149
+ initialise (int argc, char* argv[]);
150
+
151
+ /**
152
+ * @brief Returns 0 if all tests were successful, 1 otherwise.
153
+ *
154
+ * @par Parameters
155
+ * None.
156
+ * @return Integer exit code representing the overall test result.
157
+ */
158
+ int
159
+ exit_code (void);
160
+
161
+ /**
162
+ * @brief Adds a test suite to the runner.
163
+ *
164
+ * @tparam Callable_T The type of a callable object.
165
+ * @tparam Args_T The types of the callable arguments.
166
+ *
167
+ * @param [in] name The test suite name or description, used in reports.
168
+ * @param [in] callable A generic callable object, usually a lambda,
169
+ * invoked to perform the test suite.
170
+ * @param [in] arguments A possibly empty list of arguments to be passed to
171
+ * the callable.
172
+ * @par Returns
173
+ * Nothing.
174
+ */
175
+ template <typename Callable_T, typename... Args_T>
176
+ void
177
+ suite (const char* name, Callable_T&& callable, Args_T&&... arguments);
178
+
179
+ // ------------------------------------------------------------------------
180
+
181
+ /**
182
+ * @brief Aborts test execution immediately.
183
+ *
184
+ * @param sl The source location from which the abort is triggered.
185
+ * @par Returns
186
+ * Nothing.
187
+ */
188
+ [[noreturn]] void
189
+ abort (const reflection::source_location& sl
190
+ = reflection::source_location::current ());
191
+
192
+ // ------------------------------------------------------------------------
193
+ // Getters.
194
+
195
+ /**
196
+ * @brief Returns the total count of registered test suites.
197
+ *
198
+ * @details
199
+ * The base implementation counts only the dynamically registered child
200
+ * suites plus the implicit top suite. `static_runner` overrides this
201
+ * method to also include statically registered suites.
202
+ *
203
+ * @par Parameters
204
+ * None.
205
+ * @return The total number of test suites managed by this runner.
206
+ */
207
+ [[nodiscard]] virtual size_t
208
+ total_suites_count (void) const noexcept;
209
+
210
+ /**
211
+ * @brief Returns a reference to the test reporter.
212
+ *
213
+ * @par Parameters
214
+ * None.
215
+ * @par Returns
216
+ * Reference to the test reporter.
217
+ */
218
+ [[nodiscard]] class reporter&
219
+ reporter (void) const noexcept
220
+ {
221
+ return *reporter_;
222
+ }
223
+
224
+ /**
225
+ * @brief Gets the timings for this runner.
226
+ *
227
+ * @par Parameters
228
+ * None.
229
+ * @return A reference to the timestamps instance.
230
+ */
231
+ [[nodiscard]] timestamps&
232
+ timings () noexcept
233
+ {
234
+ return timings_;
235
+ }
236
+
237
+ /**
238
+ * @brief Gets the timings for this runner (const overload).
239
+ *
240
+ * @par Parameters
241
+ * None.
242
+ * @return A const reference to the timestamps instance.
243
+ */
244
+ [[nodiscard]] const timestamps&
245
+ timings () const noexcept
246
+ {
247
+ return timings_;
248
+ }
249
+
250
+ /**
251
+ * @brief Returns the count of test suites.
252
+ *
253
+ * @par Parameters
254
+ * None.
255
+ * @return The number of test suites, including the top one.
256
+ */
257
+ [[nodiscard]] size_t
258
+ suites_count (void) const noexcept;
259
+
260
+ protected:
261
+ /**
262
+ * @brief Runs all registered test suites.
263
+ *
264
+ * @details
265
+ * The base implementation runs all dynamically registered child suites.
266
+ * `static_runner` overrides this method to additionally run all
267
+ * statically registered suites.
268
+ *
269
+ * @par Parameters
270
+ * None.
271
+ */
272
+ virtual void
273
+ run_suites_ (void);
274
+
275
+ /**
276
+ * @brief Registers a test suite with the runner.
277
+ *
278
+ * @param [in] suite Owning pointer to the test suite to register.
279
+ * @par Returns
280
+ * Nothing.
281
+ */
282
+ void
283
+ register_suite_ (std::unique_ptr<class suite> suite);
284
+
285
+ // ------------------------------------------------------------------------
286
+ protected:
287
+ /**
288
+ * @brief The implicit top-level suite; always present and executed first.
289
+ */
290
+ class top_suite top_suite_;
291
+
292
+ /**
293
+ * @brief Owning collection of dynamically registered child suites.
294
+ *
295
+ * @details
296
+ * Each call to `runner::suite()` appends a new `suite` to this vector
297
+ * and runs it immediately. The vector retains ownership of all suites
298
+ * for the lifetime of the runner.
299
+ */
300
+ std::vector<std::unique_ptr<class suite>> children_suites_;
301
+
302
+ /**
303
+ * @brief Pointer to the test reporter used for outputting test results.
304
+ */
305
+ std::unique_ptr<class reporter> reporter_;
306
+
307
+ /**
308
+ * @brief Timings for this runner.
309
+ */
310
+ timestamps timings_;
311
+ };
312
+
313
+ // ==========================================================================
314
+
315
+ /**
316
+ * @ingroup micro-test-plus-runners
317
+ * @brief A `runner` variant that also manages statically-registered test
318
+ * suites.
319
+ *
320
+ * @details
321
+ * `static_runner` extends `runner` to handle `static_suite` objects that
322
+ * are declared at namespace scope and therefore constructed before or after
323
+ * the runner itself, in unspecified static-initialisation order.
324
+ *
325
+ * The key design constraint is that `static_runner` instances must
326
+ * themselves be declared at namespace scope (in the BSS segment), so the
327
+ * pointer `static_children_suites_` is zero-initialised by the C runtime
328
+ * before any constructor runs. This ensures that `static_suite` objects
329
+ * constructed before `static_runner` can safely append themselves to the
330
+ * vector without losing registrations.
331
+ *
332
+ * During `exit_code()`, `run_suites_()` is called, which first runs all
333
+ * dynamically registered suites (base class behaviour) and then iterates
334
+ * over the statically registered suites.
335
+ *
336
+ * @headerfile micro-test-plus.h <micro-os-plus/micro-test-plus.h>
337
+ */
338
+ class static_runner final : public runner
339
+ {
340
+ public:
341
+ /**
342
+ * @brief Constructs the static runner with a top-suite name.
343
+ *
344
+ * @param top_suite_name The name of the implicit top-level suite.
345
+ */
346
+ static_runner (const char* top_suite_name);
347
+
348
+ /**
349
+ * @brief Deleted copy constructor to prevent copying.
350
+ */
351
+ static_runner (const static_runner&) = delete;
352
+
353
+ /**
354
+ * @brief Deleted move constructor to prevent moving.
355
+ */
356
+ static_runner (static_runner&&) = delete;
357
+
358
+ /**
359
+ * @brief Deleted copy assignment operator to prevent copying.
360
+ */
361
+ static_runner&
362
+ operator= (const static_runner&) = delete;
363
+
364
+ /**
365
+ * @brief Deleted move assignment operator to prevent moving.
366
+ */
367
+ static_runner&
368
+ operator= (static_runner&&) = delete;
369
+
370
+ /**
371
+ * @brief Destructor for the static_runner class.
372
+ */
373
+ virtual ~static_runner () override;
374
+
375
+ // ------------------------------------------------------------------------
376
+
377
+ /**
378
+ * @brief Registers a static test suite with the runner.
379
+ *
380
+ * @param [in] runner The static runner instance.
381
+ * @param [in] suite The static test suite to register.
382
+ */
383
+ static void
384
+ register_static_suite (static_runner& runner, static_suite& suite);
385
+
386
+ /**
387
+ * @brief Returns the total count of registered static test suites.
388
+ *
389
+ * @par Parameters
390
+ * None.
391
+ * @return The total number of registered static test suites.
392
+ */
393
+ [[nodiscard]] size_t
394
+ static_suites_count (void) const noexcept;
395
+
396
+ /**
397
+ * @brief Returns the total count of all test suites, including static and
398
+ * dynamic.
399
+ *
400
+ * @par Parameters
401
+ * None.
402
+ * @return The total number of test suites.
403
+ */
404
+ [[nodiscard]] virtual size_t
405
+ total_suites_count (void) const noexcept final override;
406
+
407
+ protected:
408
+ /**
409
+ * @brief Runs all child suites, including statically registered ones.
410
+ *
411
+ * @details
412
+ * Overrides `runner::run_suites_()` to first invoke the base
413
+ * implementation (dynamic suites), then iterate over all statically
414
+ * registered suites and run them.
415
+ *
416
+ * @par Parameters
417
+ * None.
418
+ */
419
+ void
420
+ run_suites_ (void) override;
421
+
422
+ protected:
423
+ /**
424
+ * @brief Pointer to the vector of registered static test suites.
425
+ *
426
+ * `static_runner` instances are always declared at namespace scope,
427
+ * so this pointer lives in the BSS segment and is zero-initialised
428
+ * before any constructor runs. This guarantees that static test suites
429
+ * registered before this runner's constructor executes (due to
430
+ * unspecified static initialisation order across translation units)
431
+ * are not lost. The pointer MUST NOT carry an explicit
432
+ * default member initialiser, as that would run during construction
433
+ * and could overwrite a value already set by an earlier-constructed
434
+ * `static_suite`.
435
+ */
436
+ std::vector<static_suite*>* static_children_suites_;
437
+ };
438
+
439
+ } // namespace micro_os_plus::micro_test_plus
440
+
441
+ #if defined(__GNUC__)
442
+ #pragma GCC diagnostic pop
443
+ #endif
444
+
445
+ // ----------------------------------------------------------------------------
446
+
447
+ #endif // __cplusplus
448
+
449
+ // ----------------------------------------------------------------------------
450
+
451
+ #endif // MICRO_TEST_PLUS_TEST_RUNNER_H_
452
+
453
+ // ----------------------------------------------------------------------------