@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
@@ -36,13 +36,6 @@
36
36
 
37
37
  // ----------------------------------------------------------------------------
38
38
 
39
- #if defined(MICRO_OS_PLUS_INCLUDE_CONFIG_H)
40
- #include <micro-os-plus/config.h>
41
- #endif // MICRO_OS_PLUS_INCLUDE_CONFIG_H
42
-
43
- #include <micro-os-plus/micro-test-plus.h>
44
- #include <micro-os-plus/diag/trace.h>
45
-
46
39
  // For the PRIu32 macro used in snprintf() formatting of uint32_t values.
47
40
  #include <cinttypes>
48
41
 
@@ -51,6 +44,18 @@
51
44
  #include <unistd.h>
52
45
  #endif
53
46
 
47
+ #if defined(MICRO_OS_PLUS_INCLUDE_CONFIG_H)
48
+ #include <micro-os-plus/config.h>
49
+ #endif // MICRO_OS_PLUS_INCLUDE_CONFIG_H
50
+
51
+ #if defined(MICRO_OS_PLUS_TRACE)
52
+ #include <micro-os-plus/diag/trace.h>
53
+ #endif // MICRO_OS_PLUS_TRACE
54
+
55
+ #include "micro-os-plus/micro-test-plus/reporter-human.h"
56
+ #include "micro-os-plus/micro-test-plus/runner.h"
57
+ #include "micro-os-plus/micro-test-plus/test.h"
58
+
54
59
  // ----------------------------------------------------------------------------
55
60
 
56
61
  #if defined(__GNUC__)
@@ -88,7 +93,7 @@ namespace micro_os_plus::micro_test_plus
88
93
  #if defined(__APPLE__) || defined(__linux__) || defined(__unix__)
89
94
  if (isatty (fileno (stdout)))
90
95
  {
91
- colours_ = colours_red_green;
96
+ colours_ = detail::colours_red_green;
92
97
  }
93
98
  #endif
94
99
  }
@@ -126,7 +131,7 @@ namespace micro_os_plus::micro_test_plus
126
131
  * folders by allowing `*this << indent(n) << "text"` chaining.
127
132
  */
128
133
  reporter_human&
129
- reporter_human::operator<< (indent_t m)
134
+ reporter_human::operator<< (detail::indent_t m)
130
135
  {
131
136
  buffer_.append (m.level * indent_size, ' ');
132
137
  return *this;
@@ -288,7 +293,7 @@ namespace micro_os_plus::micro_test_plus
288
293
  * cases and folders.
289
294
  */
290
295
  void
291
- reporter_human::begin_suite ([[maybe_unused]] suite& suite)
296
+ reporter_human::begin_suite (suite& suite)
292
297
  {
293
298
  #if defined(MICRO_OS_PLUS_TRACE) \
294
299
  && defined(MICRO_OS_PLUS_TRACE_MICRO_TEST_PLUS)
@@ -481,7 +486,7 @@ namespace micro_os_plus::micro_test_plus
481
486
  * results across all test cases and folders.
482
487
  */
483
488
  void
484
- reporter_human::begin_subtest ([[maybe_unused]] subtest& subtest)
489
+ reporter_human::begin_subtest (subtest& subtest)
485
490
  {
486
491
  #if defined(MICRO_OS_PLUS_TRACE) \
487
492
  && defined(MICRO_OS_PLUS_TRACE_MICRO_TEST_PLUS)
@@ -694,9 +699,9 @@ namespace micro_os_plus::micro_test_plus
694
699
 
695
700
  /**
696
701
  * @details
697
- * This method outputs the prefix for a passing test result, applying the
702
+ * This method outputs the prefix for a passing check result, applying the
698
703
  * appropriate colour formatting and symbols to clearly indicate success. If
699
- * the output occurs within a test case, additional indentation is applied
704
+ * the output occurs within a subtest, additional indentation is applied
700
705
  * for readability. The prefix includes a tick symbol (`✓`) and, if provided,
701
706
  * an associated message. Colour formatting is reset after the prefix to
702
707
  * maintain consistent output style across all test cases and folders.
@@ -705,8 +710,7 @@ namespace micro_os_plus::micro_test_plus
705
710
  * generated by the template methods.
706
711
  */
707
712
  void
708
- reporter_human::output_pass_prefix_ (std::string& message,
709
- [[maybe_unused]] subtest& subtest)
713
+ reporter_human::output_pass_prefix_ (std::string& message, subtest& subtest)
710
714
  {
711
715
  size_t level = subtest.nesting_depth ();
712
716
 
@@ -720,16 +724,9 @@ namespace micro_os_plus::micro_test_plus
720
724
 
721
725
  /**
722
726
  * @details
723
- * The `endl` function acts as a stream manipulator for the `reporter`,
724
- * inserting a line ending into the output buffer and flushing the current
725
- * content if necessary. This ensures that test report output is clearly
726
- * separated and formatted, improving readability and professionalism in the
727
- * presentation of test results.
728
- *
729
- * Using `endl` in conjunction with the `reporter` output operators
730
- * provides a familiar and convenient mechanism for managing line breaks,
731
- * similar to standard C++ stream manipulators.
732
- *
727
+ * Completes pass output by appending `endl` and flushing buffered
728
+ * content to the configured sinks.
729
+
733
730
  * The prefix/suffix methods help shorten the code
734
731
  * generated by the template methods.
735
732
  */
@@ -743,9 +740,9 @@ namespace micro_os_plus::micro_test_plus
743
740
 
744
741
  /**
745
742
  * @details
746
- * This method outputs the prefix for a failing test result, applying the
743
+ * This method outputs the prefix for a failing check result, applying the
747
744
  * appropriate colour formatting and symbols to clearly indicate failure. If
748
- * the output occurs within a test case, additional indentation is applied
745
+ * the output occurs within a subtest, additional indentation is applied
749
746
  * for readability. The prefix includes a cross symbol (`✗`), an optional
750
747
  * message, and the label "FAILED". The source location is appended in
751
748
  * parentheses, showing the file or folder name and line number where the
@@ -754,9 +751,8 @@ namespace micro_os_plus::micro_test_plus
754
751
  */
755
752
  void
756
753
  reporter_human::output_fail_prefix_ (
757
- std::string& message, const bool hasExpression,
758
- const reflection::source_location& location,
759
- [[maybe_unused]] subtest& subtest)
754
+ std::string& message, const bool has_expression,
755
+ const reflection::source_location& location, subtest& subtest)
760
756
  {
761
757
  #if defined(__GNUC__)
762
758
  #pragma GCC diagnostic push
@@ -779,10 +775,8 @@ namespace micro_os_plus::micro_test_plus
779
775
  }
780
776
  *this << colours_.fail << "FAILED" << colours_.none;
781
777
  *this << " (" << reflection::short_name (location.file_name ()) << ":"
782
- << type_traits::genuine_integral_value<unsigned int>{
783
- location.line ()
784
- };
785
- if (hasExpression)
778
+ << location.line ();
779
+ if (has_expression)
786
780
  {
787
781
  *this << ", ";
788
782
  }
@@ -794,9 +788,9 @@ namespace micro_os_plus::micro_test_plus
794
788
 
795
789
  /**
796
790
  * @details
797
- * This method outputs the suffix for a failing test result by closing the
798
- * location information, appending an "aborted..." message if the test was
799
- * aborted, and then adding a newline to the test output. The output stream
791
+ * This method outputs the suffix for a failing check result by closing the
792
+ * location information, appending an "aborted..." message if the check was
793
+ * aborted, and then adding a newline to the output. The output stream
800
794
  * is flushed to ensure immediate visibility. This approach guarantees that
801
795
  * failure results are clearly separated, promptly reported, and easily
802
796
  * distinguishable across all test cases and folders.
@@ -34,15 +34,20 @@
34
34
 
35
35
  // ----------------------------------------------------------------------------
36
36
 
37
+ // For the PRIu32 macro used in snprintf() formatting of uint32_t values.
38
+ #include <cinttypes>
39
+
37
40
  #if defined(MICRO_OS_PLUS_INCLUDE_CONFIG_H)
38
41
  #include <micro-os-plus/config.h>
39
42
  #endif // MICRO_OS_PLUS_INCLUDE_CONFIG_H
40
43
 
41
- #include <micro-os-plus/micro-test-plus.h>
44
+ #if defined(MICRO_OS_PLUS_TRACE)
42
45
  #include <micro-os-plus/diag/trace.h>
46
+ #endif // MICRO_OS_PLUS_TRACE
43
47
 
44
- // For the PRIu32 macro used in snprintf() formatting of uint32_t values.
45
- #include <cinttypes>
48
+ #include "micro-os-plus/micro-test-plus/reporter-tap.h"
49
+ #include "micro-os-plus/micro-test-plus/runner.h"
50
+ #include "micro-os-plus/micro-test-plus/test.h"
46
51
 
47
52
  // ----------------------------------------------------------------------------
48
53
 
@@ -103,7 +108,7 @@ namespace micro_os_plus::micro_test_plus
103
108
  * folders by allowing `*this << indent(n) << "text"` chaining.
104
109
  */
105
110
  reporter_tap&
106
- reporter_tap::operator<< (indent_t m)
111
+ reporter_tap::operator<< (detail::indent_t m)
107
112
  {
108
113
  buffer_.append (m.level * indent_size, ' ');
109
114
  return *this;
@@ -656,9 +661,9 @@ namespace micro_os_plus::micro_test_plus
656
661
 
657
662
  /**
658
663
  * @details
659
- * This method outputs the prefix for a passing suite result, applying the
664
+ * This method outputs the prefix for a passing check result, applying the
660
665
  * appropriate colour formatting and symbols to clearly indicate success. If
661
- * the output occurs within a test case, additional indentation is applied
666
+ * the output occurs within a subtest, additional indentation is applied
662
667
  * for readability. The prefix includes a tick symbol (`✓`) and, if provided,
663
668
  * an associated message. Colour formatting is reset after the prefix to
664
669
  * maintain consistent output style across all test cases and folders.
@@ -680,16 +685,9 @@ namespace micro_os_plus::micro_test_plus
680
685
 
681
686
  /**
682
687
  * @details
683
- * The `endl` function acts as a stream manipulator for the `reporter`,
684
- * inserting a line ending into the output buffer and flushing the current
685
- * content if necessary. This ensures that suite report output is clearly
686
- * separated and formatted, improving readability and professionalism in the
687
- * presentation of suite results.
688
- *
689
- * Using `endl` in conjunction with the `reporter` output operators
690
- * provides a familiar and convenient mechanism for managing line breaks,
691
- * similar to standard C++ stream manipulators.
692
- *
688
+ * Completes pass output by appending `endl` and flushing buffered
689
+ * content to the configured sinks.
690
+
693
691
  * The prefix/suffix methods help shorten the code
694
692
  * generated by the template methods.
695
693
  */
@@ -703,18 +701,16 @@ namespace micro_os_plus::micro_test_plus
703
701
 
704
702
  /**
705
703
  * @details
706
- * This method outputs the prefix for a failing suite result, applying the
704
+ * This method outputs the prefix for a failing check result, applying the
707
705
  * appropriate colour formatting and symbols to clearly indicate failure. If
708
- * the output occurs within a test case, additional indentation is applied
706
+ * the output occurs within a subtest, additional indentation is applied
709
707
  * for readability. The prefix includes a cross symbol (`✗`), an optional
710
- * message, and the label "FAILED". The source location is appended in
711
- * parentheses, showing the file or folder name and line number where the
712
- * failure occurred. Colour formatting is reset after the prefix to maintain
713
- * consistent output style across all test cases and folders.
708
+ * message, and YAML diagnostics preamble. Colour formatting and line
709
+ * structure are arranged to conform to TAP14 diagnostics output.
714
710
  */
715
711
  void
716
712
  reporter_tap::output_fail_prefix_ (
717
- std::string& message, [[maybe_unused]] const bool hasExpression,
713
+ std::string& message, const bool has_expression,
718
714
  [[maybe_unused]] const reflection::source_location& location,
719
715
  subtest& subtest)
720
716
  {
@@ -731,7 +727,7 @@ namespace micro_os_plus::micro_test_plus
731
727
  // https://testanything.org/tap-version-14-specification.html
732
728
  // 2-space indentation for YAML diagnostics.
733
729
  *this << indent (level + 1) << " ---";
734
- if (hasExpression)
730
+ if (has_expression)
735
731
  {
736
732
  *this << endl;
737
733
  *this << indent (level + 1) << " condition: ";
@@ -740,17 +736,14 @@ namespace micro_os_plus::micro_test_plus
740
736
 
741
737
  /**
742
738
  * @details
743
- * This method outputs the suffix for a failing suite result by closing the
744
- * location information, appending an "aborted..." message if the suite was
745
- * aborted, and then adding a newline to the suite output. The output stream
746
- * is flushed to ensure immediate visibility. This approach guarantees that
747
- * failure results are clearly separated, promptly reported, and easily
748
- * distinguishable across all test cases and folders.
739
+ * Completes TAP14 YAML diagnostics for a failing check, optionally appends
740
+ * an "aborted..." marker, emits source filename/line fields, closes the
741
+ * YAML block, and flushes the stream.
749
742
  */
750
743
  void
751
744
  reporter_tap::output_fail_suffix_ (
752
745
  const reflection::source_location& location, bool abort,
753
- [[maybe_unused]] subtest& subtest)
746
+ subtest& subtest)
754
747
  {
755
748
  size_t level = subtest.nesting_depth ();
756
749
  if (abort)
@@ -766,10 +759,7 @@ namespace micro_os_plus::micro_test_plus
766
759
  *this << indent (level + 1)
767
760
  << " filename: " << reflection::short_name (location.file_name ())
768
761
  << endl;
769
- *this << indent (level + 1) << " line: "
770
- << type_traits::genuine_integral_value<unsigned int>{ location
771
- .line () }
772
- << endl;
762
+ *this << indent (level + 1) << " line: " << location.line () << endl;
773
763
 
774
764
  *this << indent (level + 1) << " ..." << endl;
775
765
 
package/src/reporter.cpp CHANGED
@@ -22,17 +22,14 @@
22
22
  *
23
23
  * @details
24
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.
25
+ * facilities of the µTest++ framework. It provides lifecycle and utility
26
+ * behaviour for reporters, including command-line option parsing,
27
+ * output-file handling, informational banner emission, buffering helpers,
28
+ * stream operators, and pass/fail dispatch to reporter-specific prefix/
29
+ * suffix hooks.
29
30
  *
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.
31
+ * Concrete formatting behaviour is implemented by derived reporters
32
+ * (`reporter_human` and `reporter_tap`).
36
33
  *
37
34
  * All definitions reside within the `micro_os_plus::micro_test_plus`
38
35
  * namespace, ensuring clear separation from user code and minimising the risk
@@ -47,8 +44,11 @@
47
44
  #include <micro-os-plus/config.h>
48
45
  #endif // MICRO_OS_PLUS_INCLUDE_CONFIG_H
49
46
 
50
- #include <micro-os-plus/micro-test-plus.h>
47
+ #if defined(MICRO_OS_PLUS_TRACE)
51
48
  #include <micro-os-plus/diag/trace.h>
49
+ #endif // MICRO_OS_PLUS_TRACE
50
+
51
+ #include "micro-os-plus/micro-test-plus/reporter.h"
52
52
 
53
53
  // ----------------------------------------------------------------------------
54
54
 
@@ -436,238 +436,43 @@ namespace micro_os_plus::micro_test_plus
436
436
 
437
437
  /**
438
438
  * @details
439
- * This operator overload appends the string representation of the specified
440
- * boolean value to the internal output buffer of the `reporter`. It
441
- * enables clear and direct streaming of boolean results into the reporter,
442
- * supporting precise and readable formatting of test output across all test
443
- * cases and folders.
444
- */
445
- reporter&
446
- reporter::operator<< (bool v)
447
- {
448
- buffer_.append (v ? "true" : "false");
449
- return *this;
450
- }
451
-
452
- /**
453
- * @details
454
- * This operator overload appends the string "nullptr" to the internal output
455
- * buffer of the `reporter`. It enables clear and explicit streaming of
456
- * null pointer values into the reporter, supporting precise and readable
457
- * formatting of test output across all test cases and folders.
458
- */
459
- reporter&
460
- reporter::operator<< (std::nullptr_t)
461
- {
462
- buffer_.append ("nullptr");
463
- return *this;
464
- }
465
-
466
- /**
467
- * @details
468
- * This operator overload appends the string representation of the specified
469
- * signed character to the internal output buffer of the `reporter`. It
470
- * enables precise and readable streaming of character values into the
471
- * reporter, supporting clear formatting of test output across all test cases
472
- * and folders.
473
- */
474
- reporter&
475
- reporter::operator<< (signed char c)
476
- {
477
- append_number_ (buffer_, c);
478
- buffer_.append ("c");
479
- return *this;
480
- }
481
-
482
- /**
483
- * @details
484
- * This operator overload appends the string representation of the specified
485
- * unsigned character to the internal output buffer of the `reporter`.
486
- * It enables precise and readable streaming of unsigned character values
487
- * into the reporter, supporting clear formatting of test output across all
488
- * test cases and folders.
489
- */
490
- reporter&
491
- reporter::operator<< (unsigned char c)
492
- {
493
- append_number_ (buffer_, c);
494
- buffer_.append ("uc");
495
- return *this;
496
- }
497
-
498
- /**
499
- * @details
500
- * This operator overload appends the string representation of the specified
501
- * signed short integer to the internal output buffer of the `reporter`.
502
- * It enables precise and readable streaming of signed short values into the
503
- * reporter, supporting clear formatting of test output across all test cases
504
- * and folders.
505
- */
506
- reporter&
507
- reporter::operator<< (signed short v)
508
- {
509
- append_number_ (buffer_, v);
510
- buffer_.append ("s");
511
- return *this;
512
- }
513
-
514
- /**
515
- * @details
516
- * This operator overload appends the string representation of the specified
517
- * unsigned short integer to the internal output buffer of the
518
- * `reporter`. It enables precise and readable streaming of unsigned
519
- * short values into the reporter, supporting clear formatting of test output
520
- * across all test cases and folders.
439
+ * Outputs a pass prefix, followed by either the provided message or, if
440
+ * the message is empty, the evaluated expression string itself. A pass
441
+ * suffix is then appended to complete the output.
521
442
  */
522
- reporter&
523
- reporter::operator<< (unsigned short v)
524
- {
525
- append_number_ (buffer_, v);
526
- buffer_.append ("us");
527
- return *this;
528
- }
529
-
530
- /**
531
- * @details
532
- * This operator overload appends the string representation of the specified
533
- * signed integer to the internal output buffer of the `reporter`. It
534
- * enables precise and readable streaming of signed integer values into the
535
- * reporter, supporting clear formatting of test output across all test cases
536
- * and folders.
537
- */
538
- reporter&
539
- reporter::operator<< (signed int v)
540
- {
541
- append_number_ (buffer_, v);
542
- return *this;
543
- }
544
-
545
- /**
546
- * @details
547
- * This operator overload appends the string representation of the specified
548
- * unsigned integer to the internal output buffer of the `reporter`. It
549
- * enables precise and readable streaming of unsigned integer values into the
550
- * reporter, supporting clear formatting of test output across all test cases
551
- * and folders.
552
- */
553
- reporter&
554
- reporter::operator<< (unsigned int v)
555
- {
556
- append_number_ (buffer_, v);
557
- buffer_.append ("u");
558
- return *this;
559
- }
560
-
561
- /**
562
- * @details
563
- * This operator overload appends the string representation of the specified
564
- * signed long integer to the internal output buffer of the `reporter`.
565
- * It enables precise and readable streaming of signed long values into the
566
- * reporter, supporting clear formatting of test output across all test cases
567
- * and folders.
568
- */
569
- reporter&
570
- reporter::operator<< (signed long v)
571
- {
572
- append_number_ (buffer_, v);
573
- buffer_.append ("l");
574
- return *this;
575
- }
576
-
577
- /**
578
- * @details
579
- * This operator overload appends the string representation of the specified
580
- * unsigned long integer to the internal output buffer of the
581
- * `reporter`. It enables precise and readable streaming of unsigned
582
- * long values into the reporter, supporting clear formatting of test output
583
- * across all test cases and folders.
584
- */
585
- reporter&
586
- reporter::operator<< (unsigned long v)
443
+ void
444
+ reporter::pass (std::string& message, const std::string& expression,
445
+ subtest& subtest)
587
446
  {
588
- append_number_ (buffer_, v);
589
- buffer_.append ("ul");
590
- return *this;
591
- }
447
+ output_pass_prefix_ (message, subtest);
592
448
 
593
- /**
594
- * @details
595
- * This operator overload appends the string representation of the specified
596
- * signed long long integer to the internal output buffer of the
597
- * `reporter`. It enables precise and readable streaming of signed long
598
- * long values into the reporter, supporting clear formatting of test output
599
- * across all test cases and folders.
600
- */
601
- reporter&
602
- reporter::operator<< (signed long long v)
603
- {
604
- append_number_ (buffer_, v);
605
- buffer_.append ("ll");
606
- return *this;
607
- }
449
+ if (message.empty ())
450
+ {
451
+ *this << expression;
452
+ }
608
453
 
609
- /**
610
- * @details
611
- * This operator overload appends the string representation of the specified
612
- * unsigned long long integer to the internal output buffer of the
613
- * `reporter`. It enables precise and readable streaming of unsigned
614
- * long long values into the reporter, supporting clear formatting of test
615
- * output across all test cases and folders.
616
- */
617
- reporter&
618
- reporter::operator<< (unsigned long long v)
619
- {
620
- append_number_ (buffer_, v);
621
- buffer_.append ("ull");
622
- return *this;
454
+ output_pass_suffix_ (subtest);
623
455
  }
624
456
 
625
457
  /**
626
458
  * @details
627
- * This operator overload appends the string representation of the specified
628
- * floating-point value to the internal output buffer of the `reporter`,
629
- * followed by the character 'f' to indicate a float type. It enables precise
630
- * and readable streaming of float values into the reporter, supporting clear
631
- * formatting of test output across all test cases and folders.
459
+ * Reports a test failure, formatting the output with source location and,
460
+ * when `has_expression` is true, the pre-formatted expression string.
632
461
  */
633
- reporter&
634
- reporter::operator<< (float v)
462
+ void
463
+ reporter::fail (bool abort, std::string& message,
464
+ const std::string& expression, bool has_expression,
465
+ const reflection::source_location& location,
466
+ subtest& subtest)
635
467
  {
636
- append_number_ (buffer_, v);
637
- buffer_.append ("f");
638
- return *this;
639
- }
468
+ output_fail_prefix_ (message, has_expression, location, subtest);
640
469
 
641
- /**
642
- * @details
643
- * This operator overload appends the string representation of the specified
644
- * double-precision floating-point value to the internal output buffer of the
645
- * `reporter`. It enables precise and readable streaming of double
646
- * values into the reporter, supporting clear formatting of test output
647
- * across all test cases and folders.
648
- */
649
- reporter&
650
- reporter::operator<< (double v)
651
- {
652
- append_number_ (buffer_, v);
653
- return *this;
654
- }
470
+ if (has_expression)
471
+ {
472
+ *this << expression;
473
+ }
655
474
 
656
- /**
657
- * @details
658
- * This operator overload appends the string representation of the specified
659
- * long double-precision floating-point value to the internal output buffer
660
- * of the `reporter`, followed by the character 'l' to indicate a long
661
- * double type. It enables precise and readable streaming of long double
662
- * values into the reporter, supporting clear formatting of test output
663
- * across all test cases and folders.
664
- */
665
- reporter&
666
- reporter::operator<< (long double v)
667
- {
668
- append_number_ (buffer_, v);
669
- buffer_.append ("l");
670
- return *this;
475
+ output_fail_suffix_ (location, abort, subtest);
671
476
  }
672
477
 
673
478
  // --------------------------------------------------------------------------
@@ -38,8 +38,11 @@
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
+ #if defined(MICRO_OS_PLUS_TRACE)
42
42
  #include <micro-os-plus/diag/trace.h>
43
+ #endif // MICRO_OS_PLUS_TRACE
44
+
45
+ #include "micro-os-plus/micro-test-plus/runner-totals.h"
43
46
 
44
47
  // ----------------------------------------------------------------------------
45
48
 
@@ -52,7 +55,7 @@
52
55
 
53
56
  // ============================================================================
54
57
 
55
- namespace micro_os_plus::micro_test_plus
58
+ namespace micro_os_plus::micro_test_plus::detail
56
59
  {
57
60
  // ===========================================================================
58
61
 
@@ -90,6 +93,6 @@ namespace micro_os_plus::micro_test_plus
90
93
  }
91
94
 
92
95
  // --------------------------------------------------------------------------
93
- } // namespace micro_os_plus::micro_test_plus
96
+ } // namespace micro_os_plus::micro_test_plus::detail
94
97
 
95
98
  // ----------------------------------------------------------------------------