@micro-os-plus/micro-test-plus 3.2.0 → 3.2.3

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 (42) hide show
  1. package/.cmake-format.yaml +11 -0
  2. package/CHANGELOG.md +502 -11
  3. package/CMakeLists.txt +33 -32
  4. package/LICENSE +1 -1
  5. package/README.md +15 -14
  6. package/config/xcdl-build.json +32 -0
  7. package/include/micro-os-plus/micro-test-plus/detail.h +1885 -0
  8. package/include/micro-os-plus/micro-test-plus/function-comparators.h +333 -0
  9. package/include/micro-os-plus/micro-test-plus/inlines/details-inlines.h +172 -0
  10. package/include/micro-os-plus/micro-test-plus/inlines/function-comparators-inlines.h +341 -0
  11. package/include/micro-os-plus/micro-test-plus/inlines/literals-inlines.h +604 -0
  12. package/include/micro-os-plus/micro-test-plus/inlines/math-inlines.h +315 -0
  13. package/include/micro-os-plus/micro-test-plus/inlines/micro-test-plus-inlines.h +313 -0
  14. package/include/micro-os-plus/micro-test-plus/inlines/reflection-inlines.h +170 -0
  15. package/include/micro-os-plus/micro-test-plus/inlines/test-reporter-inlines.h +471 -0
  16. package/include/micro-os-plus/micro-test-plus/inlines/test-suite-inlines.h +115 -0
  17. package/include/micro-os-plus/micro-test-plus/literals.h +912 -0
  18. package/include/micro-os-plus/micro-test-plus/math.h +217 -0
  19. package/include/micro-os-plus/micro-test-plus/operators.h +514 -0
  20. package/include/micro-os-plus/micro-test-plus/reflection.h +233 -0
  21. package/include/micro-os-plus/micro-test-plus/test-reporter.h +801 -0
  22. package/include/micro-os-plus/micro-test-plus/test-runner.h +241 -0
  23. package/include/micro-os-plus/micro-test-plus/test-suite.h +456 -0
  24. package/include/micro-os-plus/micro-test-plus/type-traits.h +1148 -0
  25. package/include/micro-os-plus/micro-test-plus.h +171 -554
  26. package/meson.build +6 -7
  27. package/package.json +40 -32
  28. package/src/micro-test-plus.cpp +143 -42
  29. package/src/test-reporter.cpp +350 -9
  30. package/src/test-runner.cpp +77 -14
  31. package/src/test-suite.cpp +132 -14
  32. package/LICENSE-Boost +0 -23
  33. package/include/micro-os-plus/detail.h +0 -766
  34. package/include/micro-os-plus/inlines.h +0 -204
  35. package/include/micro-os-plus/literals.h +0 -513
  36. package/include/micro-os-plus/math.h +0 -205
  37. package/include/micro-os-plus/reflection.h +0 -139
  38. package/include/micro-os-plus/test-reporter-inlines.h +0 -231
  39. package/include/micro-os-plus/test-reporter.h +0 -357
  40. package/include/micro-os-plus/test-runner.h +0 -133
  41. package/include/micro-os-plus/test-suite.h +0 -307
  42. package/include/micro-os-plus/type-traits.h +0 -390
@@ -1,17 +1,44 @@
1
1
  /*
2
- * This file is part of the µOS++ distribution.
3
- * (https://github.com/micro-os-plus/)
4
- * Copyright (c) 2021 Liviu Ionescu.
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.
5
4
  *
6
- * Permission to use, copy, modify, and/or distribute this software
7
- * for any purpose is hereby granted, under the terms of the MIT license.
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.
8
7
  *
9
- * If a copy of the license was not distributed with this file, it can
10
- * be obtained from <https://opensource.org/licenses/MIT/>.
8
+ * If a copy of the license was not distributed with this file, it can be
9
+ * obtained from https://opensource.org/licenses/mit.
11
10
  *
12
11
  * Major parts of the code are inspired from v1.1.8 of the Boost UT project,
13
12
  * released under the terms of the Boost Version 1.0 Software License,
14
- * which can be obtained from <https://www.boost.org/LICENSE_1_0.txt>.
13
+ * which can be obtained from https://www.boost.org/LICENSE_1_0.txt.
14
+ */
15
+
16
+ // ----------------------------------------------------------------------------
17
+
18
+ /**
19
+ * @file
20
+ * @brief C++ source file with implementations for the µTest++ test reporter
21
+ * methods.
22
+ *
23
+ * @details
24
+ * This source file contains the core implementations for the test reporting
25
+ * facilities of the µTest++ framework. It provides the logic for formatting
26
+ * and outputting test results, including operator overloads for a wide range
27
+ * of value types, containers, and comparison expressions, as well as
28
+ * structured output for logical and exception-related assertions.
29
+ *
30
+ * The test reporter is responsible for presenting test outcomes in a clear,
31
+ * consistent, and expressive manner, supporting both value and pointer
32
+ * semantics, and providing detailed diagnostics for both successful and failed
33
+ * test cases. Special attention is given to formatting, colour highlighting,
34
+ * and extensibility, enabling professional and readable test reports suitable
35
+ * for embedded and general C++ development.
36
+ *
37
+ * All definitions reside within the `micro_os_plus::micro_test_plus`
38
+ * namespace, ensuring clear separation from user code and minimising the risk
39
+ * of naming conflicts.
40
+ *
41
+ * This file must be included when building the µTest++ library.
15
42
  */
16
43
 
17
44
  // ----------------------------------------------------------------------------
@@ -26,6 +53,7 @@
26
53
 
27
54
  #pragma GCC diagnostic ignored "-Waggregate-return"
28
55
  #if defined(__clang__)
56
+ #pragma clang diagnostic ignored "-Wunknown-warning-option"
29
57
  #pragma clang diagnostic ignored "-Wc++98-compat"
30
58
  #pragma clang diagnostic ignored "-Wc++98-compat-pedantic"
31
59
  #endif
@@ -34,6 +62,14 @@ namespace micro_os_plus::micro_test_plus
34
62
  {
35
63
  // --------------------------------------------------------------------------
36
64
 
65
+ /**
66
+ * @details
67
+ * The `endl` function inserts a newline character into the specified
68
+ * `test_reporter` stream and flushes its output buffer. This operation
69
+ * ensures that each test output line is clearly separated and immediately
70
+ * visible, facilitating the readability and clarity of test results across
71
+ * all test cases and folders within the µTest++ framework.
72
+ */
37
73
  test_reporter&
38
74
  endl (test_reporter& stream)
39
75
  {
@@ -43,6 +79,18 @@ namespace micro_os_plus::micro_test_plus
43
79
 
44
80
  // --------------------------------------------------------------------------
45
81
 
82
+ /**
83
+ * @details
84
+ * This method outputs the prefix for a passing test result, applying the
85
+ * appropriate colour formatting and symbols to clearly indicate success. If
86
+ * the output occurs within a test case, additional indentation is applied
87
+ * for readability. The prefix includes a tick symbol (`✓`) and, if provided,
88
+ * an associated message. Colour formatting is reset after the prefix to
89
+ * maintain consistent output style across all test cases and folders.
90
+ *
91
+ * The prefix/suffix methods help shorten the code
92
+ * generated by the template methods.
93
+ */
46
94
  void
47
95
  test_reporter::output_pass_prefix_ (std::string& message)
48
96
  {
@@ -59,6 +107,21 @@ namespace micro_os_plus::micro_test_plus
59
107
  }
60
108
  }
61
109
 
110
+ /**
111
+ * @details
112
+ * The `endl` function acts as a stream manipulator for the `test_reporter`,
113
+ * inserting a line ending into the output buffer and flushing the current
114
+ * content if necessary. This ensures that test report output is clearly
115
+ * separated and formatted, improving readability and professionalism in the
116
+ * presentation of test results.
117
+ *
118
+ * Using `endl` in conjunction with the `test_reporter` output operators
119
+ * provides a familiar and convenient mechanism for managing line breaks,
120
+ * similar to standard C++ stream manipulators.
121
+ *
122
+ * The prefix/suffix methods help shorten the code
123
+ * generated by the template methods.
124
+ */
62
125
  void
63
126
  test_reporter::output_pass_suffix_ (void)
64
127
  {
@@ -67,6 +130,17 @@ namespace micro_os_plus::micro_test_plus
67
130
  flush ();
68
131
  }
69
132
 
133
+ /**
134
+ * @details
135
+ * This method outputs the prefix for a failing test result, applying the
136
+ * appropriate colour formatting and symbols to clearly indicate failure. If
137
+ * the output occurs within a test case, additional indentation is applied
138
+ * for readability. The prefix includes a cross symbol (`✗`), an optional
139
+ * message, and the label "FAILED". The source location is appended in
140
+ * parentheses, showing the file or folder name and line number where the
141
+ * failure occurred. Colour formatting is reset after the prefix to maintain
142
+ * consistent output style across all test cases and folders.
143
+ */
70
144
  void
71
145
  test_reporter::output_fail_prefix_ (
72
146
  std::string& message, const reflection::source_location& location)
@@ -98,6 +172,15 @@ namespace micro_os_plus::micro_test_plus
98
172
  #pragma GCC diagnostic pop
99
173
  }
100
174
 
175
+ /**
176
+ * @details
177
+ * This method outputs the suffix for a failing test result by closing the
178
+ * location information, appending an "aborted..." message if the test was
179
+ * aborted, and then adding a newline to the test output. The output stream
180
+ * is flushed to ensure immediate visibility. This approach guarantees that
181
+ * failure results are clearly separated, promptly reported, and easily
182
+ * distinguishable across all test cases and folders.
183
+ */
101
184
  void
102
185
  test_reporter::output_fail_suffix_ (bool abort)
103
186
  {
@@ -111,6 +194,15 @@ namespace micro_os_plus::micro_test_plus
111
194
  flush ();
112
195
  }
113
196
 
197
+ /**
198
+ * @details
199
+ * This operator overload enables manipulators, such as `endl`, to be used
200
+ * with the `test_reporter` stream in a manner similar to standard C++
201
+ * streams. When a manipulator function is passed, it is invoked with the
202
+ * current `test_reporter` instance, allowing for seamless integration of
203
+ * stream operations and improved readability of test output across all test
204
+ * cases and folders.
205
+ */
114
206
  test_reporter&
115
207
  test_reporter::operator<< (test_reporter& (*func) (test_reporter&))
116
208
  {
@@ -119,6 +211,14 @@ namespace micro_os_plus::micro_test_plus
119
211
  return *this;
120
212
  }
121
213
 
214
+ /**
215
+ * @details
216
+ * This method appends a newline character to the internal output buffer of
217
+ * the `test_reporter` and immediately flushes the stream. This ensures that
218
+ * each line of test output is clearly separated and promptly displayed,
219
+ * enhancing the readability and organisation of test results across all test
220
+ * cases and folders.
221
+ */
122
222
  void
123
223
  test_reporter::endline (void)
124
224
  {
@@ -126,12 +226,27 @@ namespace micro_os_plus::micro_test_plus
126
226
  flush ();
127
227
  }
128
228
 
229
+ /**
230
+ * @details
231
+ * This method flushes the output buffer of the `test_reporter` by
232
+ * synchronising it with the standard output stream. This guarantees that all
233
+ * pending test output is immediately written and visible, ensuring prompt
234
+ * and reliable reporting of test results across all test cases and folders.
235
+ */
129
236
  void
130
237
  test_reporter::flush (void)
131
238
  {
132
239
  fflush (stdout); // Sync STDOUT.
133
240
  }
134
241
 
242
+ /**
243
+ * @details
244
+ * This operator overload appends the contents of the provided
245
+ * `std::string_view` to the internal output buffer of the `test_reporter`.
246
+ * It enables seamless streaming of string data into the reporter, supporting
247
+ * clear and efficient formatting of test output across all test cases and
248
+ * folders.
249
+ */
135
250
  test_reporter&
136
251
  test_reporter::operator<< (std::string_view sv)
137
252
  {
@@ -139,6 +254,13 @@ namespace micro_os_plus::micro_test_plus
139
254
  return *this;
140
255
  }
141
256
 
257
+ /**
258
+ * @details
259
+ * This operator overload appends the specified character to the internal
260
+ * output buffer of the `test_reporter`. It enables efficient streaming of
261
+ * individual characters into the reporter, supporting precise and flexible
262
+ * formatting of test output across all test cases and folders.
263
+ */
142
264
  test_reporter&
143
265
  test_reporter::operator<< (char c)
144
266
  {
@@ -146,6 +268,14 @@ namespace micro_os_plus::micro_test_plus
146
268
  return *this;
147
269
  }
148
270
 
271
+ /**
272
+ * @details
273
+ * This operator overload appends the contents of the provided C-style string
274
+ * to the internal output buffer of the `test_reporter`. It enables efficient
275
+ * streaming of string literals and character arrays into the reporter,
276
+ * supporting clear and flexible formatting of test output across all test
277
+ * cases and folders.
278
+ */
149
279
  test_reporter&
150
280
  test_reporter::operator<< (const char* s)
151
281
  {
@@ -153,6 +283,14 @@ namespace micro_os_plus::micro_test_plus
153
283
  return *this;
154
284
  }
155
285
 
286
+ /**
287
+ * @details
288
+ * This operator overload appends the contents of the provided modifiable
289
+ * C-style string to the internal output buffer of the `test_reporter`. It
290
+ * enables efficient streaming of mutable string data into the reporter,
291
+ * supporting clear and flexible formatting of test output across all test
292
+ * cases and folders.
293
+ */
156
294
  test_reporter&
157
295
  test_reporter::operator<< (char* s)
158
296
  {
@@ -160,6 +298,14 @@ namespace micro_os_plus::micro_test_plus
160
298
  return *this;
161
299
  }
162
300
 
301
+ /**
302
+ * @details
303
+ * This operator overload appends the string representation of the specified
304
+ * boolean value to the internal output buffer of the `test_reporter`. It
305
+ * enables clear and direct streaming of boolean results into the reporter,
306
+ * supporting precise and readable formatting of test output across all test
307
+ * cases and folders.
308
+ */
163
309
  test_reporter&
164
310
  test_reporter::operator<< (bool v)
165
311
  {
@@ -167,6 +313,13 @@ namespace micro_os_plus::micro_test_plus
167
313
  return *this;
168
314
  }
169
315
 
316
+ /**
317
+ * @details
318
+ * This operator overload appends the string "nullptr" to the internal output
319
+ * buffer of the `test_reporter`. It enables clear and explicit streaming of
320
+ * null pointer values into the reporter, supporting precise and readable
321
+ * formatting of test output across all test cases and folders.
322
+ */
170
323
  test_reporter&
171
324
  test_reporter::operator<< (std::nullptr_t)
172
325
  {
@@ -174,6 +327,14 @@ namespace micro_os_plus::micro_test_plus
174
327
  return *this;
175
328
  }
176
329
 
330
+ /**
331
+ * @details
332
+ * This operator overload appends the string representation of the specified
333
+ * signed character to the internal output buffer of the `test_reporter`. It
334
+ * enables precise and readable streaming of character values into the
335
+ * reporter, supporting clear formatting of test output across all test cases
336
+ * and folders.
337
+ */
177
338
  test_reporter&
178
339
  test_reporter::operator<< (signed char c)
179
340
  {
@@ -182,6 +343,14 @@ namespace micro_os_plus::micro_test_plus
182
343
  return *this;
183
344
  }
184
345
 
346
+ /**
347
+ * @details
348
+ * This operator overload appends the string representation of the specified
349
+ * unsigned character to the internal output buffer of the `test_reporter`.
350
+ * It enables precise and readable streaming of unsigned character values
351
+ * into the reporter, supporting clear formatting of test output across all
352
+ * test cases and folders.
353
+ */
185
354
  test_reporter&
186
355
  test_reporter::operator<< (unsigned char c)
187
356
  {
@@ -190,6 +359,14 @@ namespace micro_os_plus::micro_test_plus
190
359
  return *this;
191
360
  }
192
361
 
362
+ /**
363
+ * @details
364
+ * This operator overload appends the string representation of the specified
365
+ * signed short integer to the internal output buffer of the `test_reporter`.
366
+ * It enables precise and readable streaming of signed short values into the
367
+ * reporter, supporting clear formatting of test output across all test cases
368
+ * and folders.
369
+ */
193
370
  test_reporter&
194
371
  test_reporter::operator<< (signed short v)
195
372
  {
@@ -198,6 +375,14 @@ namespace micro_os_plus::micro_test_plus
198
375
  return *this;
199
376
  }
200
377
 
378
+ /**
379
+ * @details
380
+ * This operator overload appends the string representation of the specified
381
+ * unsigned short integer to the internal output buffer of the
382
+ * `test_reporter`. It enables precise and readable streaming of unsigned
383
+ * short values into the reporter, supporting clear formatting of test output
384
+ * across all test cases and folders.
385
+ */
201
386
  test_reporter&
202
387
  test_reporter::operator<< (unsigned short v)
203
388
  {
@@ -206,6 +391,14 @@ namespace micro_os_plus::micro_test_plus
206
391
  return *this;
207
392
  }
208
393
 
394
+ /**
395
+ * @details
396
+ * This operator overload appends the string representation of the specified
397
+ * signed integer to the internal output buffer of the `test_reporter`. It
398
+ * enables precise and readable streaming of signed integer values into the
399
+ * reporter, supporting clear formatting of test output across all test cases
400
+ * and folders.
401
+ */
209
402
  test_reporter&
210
403
  test_reporter::operator<< (signed int v)
211
404
  {
@@ -213,6 +406,14 @@ namespace micro_os_plus::micro_test_plus
213
406
  return *this;
214
407
  }
215
408
 
409
+ /**
410
+ * @details
411
+ * This operator overload appends the string representation of the specified
412
+ * unsigned integer to the internal output buffer of the `test_reporter`. It
413
+ * enables precise and readable streaming of unsigned integer values into the
414
+ * reporter, supporting clear formatting of test output across all test cases
415
+ * and folders.
416
+ */
216
417
  test_reporter&
217
418
  test_reporter::operator<< (unsigned int v)
218
419
  {
@@ -221,6 +422,14 @@ namespace micro_os_plus::micro_test_plus
221
422
  return *this;
222
423
  }
223
424
 
425
+ /**
426
+ * @details
427
+ * This operator overload appends the string representation of the specified
428
+ * signed long integer to the internal output buffer of the `test_reporter`.
429
+ * It enables precise and readable streaming of signed long values into the
430
+ * reporter, supporting clear formatting of test output across all test cases
431
+ * and folders.
432
+ */
224
433
  test_reporter&
225
434
  test_reporter::operator<< (signed long v)
226
435
  {
@@ -229,6 +438,14 @@ namespace micro_os_plus::micro_test_plus
229
438
  return *this;
230
439
  }
231
440
 
441
+ /**
442
+ * @details
443
+ * This operator overload appends the string representation of the specified
444
+ * unsigned long integer to the internal output buffer of the
445
+ * `test_reporter`. It enables precise and readable streaming of unsigned
446
+ * long values into the reporter, supporting clear formatting of test output
447
+ * across all test cases and folders.
448
+ */
232
449
  test_reporter&
233
450
  test_reporter::operator<< (unsigned long v)
234
451
  {
@@ -237,6 +454,14 @@ namespace micro_os_plus::micro_test_plus
237
454
  return *this;
238
455
  }
239
456
 
457
+ /**
458
+ * @details
459
+ * This operator overload appends the string representation of the specified
460
+ * signed long long integer to the internal output buffer of the
461
+ * `test_reporter`. It enables precise and readable streaming of signed long
462
+ * long values into the reporter, supporting clear formatting of test output
463
+ * across all test cases and folders.
464
+ */
240
465
  test_reporter&
241
466
  test_reporter::operator<< (signed long long v)
242
467
  {
@@ -245,6 +470,14 @@ namespace micro_os_plus::micro_test_plus
245
470
  return *this;
246
471
  }
247
472
 
473
+ /**
474
+ * @details
475
+ * This operator overload appends the string representation of the specified
476
+ * unsigned long long integer to the internal output buffer of the
477
+ * `test_reporter`. It enables precise and readable streaming of unsigned
478
+ * long long values into the reporter, supporting clear formatting of test
479
+ * output across all test cases and folders.
480
+ */
248
481
  test_reporter&
249
482
  test_reporter::operator<< (unsigned long long v)
250
483
  {
@@ -253,6 +486,14 @@ namespace micro_os_plus::micro_test_plus
253
486
  return *this;
254
487
  }
255
488
 
489
+ /**
490
+ * @details
491
+ * This operator overload appends the string representation of the specified
492
+ * floating-point value to the internal output buffer of the `test_reporter`,
493
+ * followed by the character 'f' to indicate a float type. It enables precise
494
+ * and readable streaming of float values into the reporter, supporting clear
495
+ * formatting of test output across all test cases and folders.
496
+ */
256
497
  test_reporter&
257
498
  test_reporter::operator<< (float v)
258
499
  {
@@ -261,6 +502,14 @@ namespace micro_os_plus::micro_test_plus
261
502
  return *this;
262
503
  }
263
504
 
505
+ /**
506
+ * @details
507
+ * This operator overload appends the string representation of the specified
508
+ * double-precision floating-point value to the internal output buffer of the
509
+ * `test_reporter`. It enables precise and readable streaming of double
510
+ * values into the reporter, supporting clear formatting of test output
511
+ * across all test cases and folders.
512
+ */
264
513
  test_reporter&
265
514
  test_reporter::operator<< (double v)
266
515
  {
@@ -268,6 +517,15 @@ namespace micro_os_plus::micro_test_plus
268
517
  return *this;
269
518
  }
270
519
 
520
+ /**
521
+ * @details
522
+ * This operator overload appends the string representation of the specified
523
+ * long double-precision floating-point value to the internal output buffer
524
+ * of the `test_reporter`, followed by the character 'l' to indicate a long
525
+ * double type. It enables precise and readable streaming of long double
526
+ * values into the reporter, supporting clear formatting of test output
527
+ * across all test cases and folders.
528
+ */
271
529
  test_reporter&
272
530
  test_reporter::operator<< (long double v)
273
531
  {
@@ -276,6 +534,17 @@ namespace micro_os_plus::micro_test_plus
276
534
  return *this;
277
535
  }
278
536
 
537
+ /**
538
+ * @details
539
+ * This method marks the beginning of a test case, setting the internal state
540
+ * to indicate that test output is now within a test case context. If there
541
+ * is pending output and the verbosity level is set to verbose, it ensures
542
+ * that output is properly separated and displayed, adding an empty line if
543
+ * necessary. The output buffer is cleared and the stream is flushed to
544
+ * guarantee that all previous output is visible before the new test case
545
+ * begins. This approach enhances the clarity and organisation of test
546
+ * results across all test cases and folders.
547
+ */
279
548
  void
280
549
  test_reporter::begin_test_case ([[maybe_unused]] const char* name)
281
550
  {
@@ -296,6 +565,18 @@ namespace micro_os_plus::micro_test_plus
296
565
  flush ();
297
566
  }
298
567
 
568
+ /**
569
+ * @details
570
+ * This method marks the end of a test case, summarising its outcome and
571
+ * outputting the results with appropriate formatting and colour coding. If
572
+ * any checks have failed, a failure message is displayed, including the
573
+ * number of successful and failed checks. For passing test cases, a success
574
+ * message is shown with the total number of checks. The output is adjusted
575
+ * according to the verbosity level, and additional spacing is managed for
576
+ * clarity. The output buffer is cleared and the stream is flushed to ensure
577
+ * all results are immediately visible, supporting clear and organised
578
+ * reporting across all test cases and folders.
579
+ */
299
580
  void
300
581
  test_reporter::end_test_case ([[maybe_unused]] const char* name)
301
582
  {
@@ -307,6 +588,10 @@ namespace micro_os_plus::micro_test_plus
307
588
  {
308
589
  printf ("\n");
309
590
  }
591
+ #pragma GCC diagnostic push
592
+ #if defined(__clang__)
593
+ #pragma clang diagnostic ignored "-Wunsafe-buffer-usage-in-libc-call"
594
+ #endif
310
595
  printf (" • %s - test case started\n", name);
311
596
  output ();
312
597
  printf (
@@ -318,6 +603,7 @@ namespace micro_os_plus::micro_test_plus
318
603
  ? "check"
319
604
  : "checks",
320
605
  current_test_suite->current_test_case.failed_checks);
606
+ #pragma GCC diagnostic pop
321
607
  add_empty_line = true;
322
608
  }
323
609
  else
@@ -328,6 +614,10 @@ namespace micro_os_plus::micro_test_plus
328
614
  }
329
615
  if (verbosity == verbosity::verbose)
330
616
  {
617
+ #pragma GCC diagnostic push
618
+ #if defined(__clang__)
619
+ #pragma clang diagnostic ignored "-Wunsafe-buffer-usage-in-libc-call"
620
+ #endif
331
621
  printf (" • %s - test case started\n", name);
332
622
  output ();
333
623
  printf (
@@ -338,11 +628,15 @@ namespace micro_os_plus::micro_test_plus
338
628
  == 1
339
629
  ? "check"
340
630
  : "checks");
341
-
631
+ #pragma GCC diagnostic pop
342
632
  add_empty_line = true;
343
633
  }
344
634
  else
345
635
  {
636
+ #pragma GCC diagnostic push
637
+ #if defined(__clang__)
638
+ #pragma clang diagnostic ignored "-Wunsafe-buffer-usage-in-libc-call"
639
+ #endif
346
640
  printf (
347
641
  " %s✓%s %s - test case passed (%d %s)\n", colors_.pass,
348
642
  colors_.none, name,
@@ -351,6 +645,7 @@ namespace micro_os_plus::micro_test_plus
351
645
  == 1
352
646
  ? "check"
353
647
  : "checks");
648
+ #pragma GCC diagnostic pop
354
649
 
355
650
  add_empty_line = false;
356
651
  }
@@ -363,6 +658,16 @@ namespace micro_os_plus::micro_test_plus
363
658
  is_in_test_case_ = false;
364
659
  }
365
660
 
661
+ /**
662
+ * @details
663
+ * This method marks the beginning of a test suite, ensuring that output is
664
+ * properly separated and clearly presented. If there is pending output, the
665
+ * stream is flushed and an empty line is added for clarity. For silent or
666
+ * quiet verbosity levels, output is suppressed. Otherwise, a message
667
+ * indicating the start of the test suite is displayed. This approach
668
+ * enhances the organisation and readability of test results across all test
669
+ * cases and folders.
670
+ */
366
671
  void
367
672
  test_reporter::begin_test_suite (const char* name)
368
673
  {
@@ -378,11 +683,28 @@ namespace micro_os_plus::micro_test_plus
378
683
  return;
379
684
  }
380
685
 
686
+ #pragma GCC diagnostic push
687
+ #if defined(__clang__)
688
+ #pragma clang diagnostic ignored "-Wunsafe-buffer-usage-in-libc-call"
689
+ #endif
381
690
  printf ("• %s - test suite started\n", name);
691
+ #pragma GCC diagnostic pop
382
692
 
383
693
  add_empty_line = true;
384
694
  }
385
695
 
696
+ /**
697
+ * @details
698
+ * This method marks the end of a test suite, summarising the overall results
699
+ * and presenting them with appropriate formatting and colour coding. If the
700
+ * suite contains test cases and the verbosity is not set to quiet, an empty
701
+ * line is added for clarity. For suites with no failed checks and at least
702
+ * one successful check, a success message is displayed, including the number
703
+ * of checks and test cases. Otherwise, a failure message is shown, detailing
704
+ * the number of successful and failed checks, as well as the total number of
705
+ * test cases. The output is immediately flushed to ensure prompt and
706
+ * organised reporting across all test cases and folders.
707
+ */
386
708
  void
387
709
  test_reporter::end_test_suite (test_suite_base& suite)
388
710
  {
@@ -400,15 +722,24 @@ namespace micro_os_plus::micro_test_plus
400
722
  // Also fail if none passed.
401
723
  if (suite.failed_checks () == 0 && suite.successful_checks () != 0)
402
724
  {
725
+ #pragma GCC diagnostic push
726
+ #if defined(__clang__)
727
+ #pragma clang diagnostic ignored "-Wunsafe-buffer-usage-in-libc-call"
728
+ #endif
403
729
  printf ("%s✓%s %s - test suite passed (%d %s in %d test %s)\n",
404
730
  colors_.pass, colors_.none, suite.name (),
405
731
  suite.successful_checks (),
406
732
  suite.successful_checks () == 1 ? "check" : "checks",
407
733
  suite.test_cases (),
408
734
  suite.test_cases () == 1 ? "case" : "cases");
735
+ #pragma GCC diagnostic pop
409
736
  }
410
737
  else
411
738
  {
739
+ #pragma GCC diagnostic push
740
+ #if defined(__clang__)
741
+ #pragma clang diagnostic ignored "-Wunsafe-buffer-usage-in-libc-call"
742
+ #endif
412
743
  printf ("%s✗%s %s - test suite %sFAILED%s (%d %s passed, %d failed, "
413
744
  "in %d test %s)\n",
414
745
  colors_.fail, colors_.none, suite.name (), colors_.fail,
@@ -416,10 +747,20 @@ namespace micro_os_plus::micro_test_plus
416
747
  suite.successful_checks () == 1 ? "check" : "checks",
417
748
  suite.failed_checks (), suite.test_cases (),
418
749
  suite.test_cases () == 1 ? "case" : "cases");
750
+ #pragma GCC diagnostic pop
419
751
  }
420
752
  flush ();
421
753
  }
422
754
 
755
+ /**
756
+ * @details
757
+ * This method writes the contents of the internal output buffer to the
758
+ * standard output stream without appending a newline character. After
759
+ * outputting the buffer, it is cleared to prepare for subsequent output.
760
+ * This approach ensures that test results are presented promptly and
761
+ * efficiently, supporting clear and organised reporting across all test
762
+ * cases and folders.
763
+ */
423
764
  void
424
765
  test_reporter::output (void)
425
766
  {