@micro-os-plus/micro-test-plus 3.3.1 → 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 (65) hide show
  1. package/CHANGELOG.md +412 -2
  2. package/CMakeLists.txt +134 -28
  3. package/README.md +3 -2
  4. package/config/xcdl-build.json +11 -4
  5. package/include/micro-os-plus/micro-test-plus/README.md +6 -0
  6. package/include/micro-os-plus/micro-test-plus/deferred-reporter.h +267 -0
  7. package/include/micro-os-plus/micro-test-plus/detail.h +272 -1425
  8. package/include/micro-os-plus/micro-test-plus/exceptions.h +125 -0
  9. package/include/micro-os-plus/micro-test-plus/expression-formatter.h +669 -0
  10. package/include/micro-os-plus/micro-test-plus/function-comparators.h +15 -7
  11. package/include/micro-os-plus/micro-test-plus/inlines/{details-inlines.h → deferred-reporter-inlines.h} +66 -44
  12. package/include/micro-os-plus/micro-test-plus/inlines/detail-inlines.h +711 -0
  13. package/include/micro-os-plus/micro-test-plus/inlines/exceptions-inline.h +137 -0
  14. package/include/micro-os-plus/micro-test-plus/inlines/{test-reporter-inlines.h → expression-formatter-inlines.h} +232 -198
  15. package/include/micro-os-plus/micro-test-plus/inlines/function-comparators-inlines.h +24 -20
  16. package/include/micro-os-plus/micro-test-plus/inlines/literals-inlines.h +50 -31
  17. package/include/micro-os-plus/micro-test-plus/inlines/math-inlines.h +25 -19
  18. package/include/micro-os-plus/micro-test-plus/inlines/operators-inlines.h +275 -0
  19. package/include/micro-os-plus/micro-test-plus/inlines/reflection-inlines.h +39 -21
  20. package/include/micro-os-plus/micro-test-plus/inlines/reporter-inlines.h +205 -0
  21. package/include/micro-os-plus/micro-test-plus/inlines/runner-inlines.h +151 -0
  22. package/include/micro-os-plus/micro-test-plus/inlines/runner-totals-inlines.h +152 -0
  23. package/include/micro-os-plus/micro-test-plus/inlines/test-inlines.h +555 -0
  24. package/include/micro-os-plus/micro-test-plus/inlines/timings-inlines.h +120 -0
  25. package/include/micro-os-plus/micro-test-plus/inlines/type-traits-inlines.h +231 -0
  26. package/include/micro-os-plus/micro-test-plus/inlines/utility-inlines.h +126 -0
  27. package/include/micro-os-plus/micro-test-plus/literals.h +12 -17
  28. package/include/micro-os-plus/micro-test-plus/math.h +14 -6
  29. package/include/micro-os-plus/micro-test-plus/operators.h +53 -209
  30. package/include/micro-os-plus/micro-test-plus/reflection.h +8 -4
  31. package/include/micro-os-plus/micro-test-plus/{test-reporter-basic.h → reporter-human.h} +80 -74
  32. package/include/micro-os-plus/micro-test-plus/{test-reporter-tap.h → reporter-tap.h} +77 -71
  33. package/include/micro-os-plus/micro-test-plus/reporter.h +619 -0
  34. package/include/micro-os-plus/micro-test-plus/runner-totals.h +250 -0
  35. package/include/micro-os-plus/micro-test-plus/runner.h +472 -0
  36. package/include/micro-os-plus/micro-test-plus/test.h +1013 -0
  37. package/include/micro-os-plus/micro-test-plus/timings.h +363 -0
  38. package/include/micro-os-plus/micro-test-plus/type-traits.h +223 -577
  39. package/include/micro-os-plus/micro-test-plus/utility.h +136 -0
  40. package/include/micro-os-plus/micro-test-plus.h +42 -236
  41. package/meson.build +11 -6
  42. package/package.json +11 -3
  43. package/src/deferred-reporter.cpp +137 -0
  44. package/src/expression-formatter.cpp +289 -0
  45. package/src/reflection.cpp +97 -0
  46. package/src/reporter-human.cpp +816 -0
  47. package/src/reporter-tap.cpp +772 -0
  48. package/src/reporter.cpp +481 -0
  49. package/src/runner-totals.cpp +98 -0
  50. package/src/runner.cpp +669 -0
  51. package/src/test.cpp +503 -0
  52. package/src/timings.cpp +210 -0
  53. package/src/utility.cpp +163 -0
  54. package/.cmake-format.yaml +0 -11
  55. package/include/micro-os-plus/micro-test-plus/inlines/micro-test-plus-inlines.h +0 -313
  56. package/include/micro-os-plus/micro-test-plus/inlines/test-suite-inlines.h +0 -115
  57. package/include/micro-os-plus/micro-test-plus/test-reporter.h +0 -846
  58. package/include/micro-os-plus/micro-test-plus/test-runner.h +0 -281
  59. package/include/micro-os-plus/micro-test-plus/test-suite.h +0 -492
  60. package/src/micro-test-plus.cpp +0 -316
  61. package/src/test-reporter-basic.cpp +0 -466
  62. package/src/test-reporter-tap.cpp +0 -530
  63. package/src/test-reporter.cpp +0 -399
  64. package/src/test-runner.cpp +0 -311
  65. package/src/test-suite.cpp +0 -304
@@ -0,0 +1,137 @@
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 inline implementations for the µTest++
21
+ * exceptions comparators.
22
+ *
23
+ * @details
24
+ * This header provides the inline implementations for the exception comparator
25
+ * templates used within the µTest++ framework.
26
+ *
27
+ * ...
28
+ *
29
+ * All definitions reside within the `micro_os_plus::micro_test_plus`
30
+ * namespace, ensuring clear separation from user code and minimising the risk
31
+ * of naming conflicts.
32
+ *
33
+ * The header files are organised within the
34
+ * `include/micro-os-plus/micro-test-plus` folder to maintain a structured and
35
+ * modular codebase.
36
+ *
37
+ * This file is intended solely for internal use within the framework and
38
+ * should not be included directly by user code.
39
+ */
40
+
41
+ #ifndef MICRO_TEST_PLUS_EXCEPTIONS_INLINES_H_
42
+ #define MICRO_TEST_PLUS_EXCEPTIONS_INLINES_H_
43
+
44
+ // ----------------------------------------------------------------------------
45
+
46
+ #ifdef __cplusplus
47
+
48
+ // ----------------------------------------------------------------------------
49
+
50
+ #if defined(__GNUC__)
51
+ #pragma GCC diagnostic push
52
+ #pragma GCC diagnostic ignored "-Waggregate-return"
53
+ #if defined(__clang__)
54
+ #pragma clang diagnostic ignored "-Wc++98-compat"
55
+ #pragma clang diagnostic ignored "-Wc++98-compat-pedantic"
56
+ #endif
57
+ #endif
58
+
59
+ // ============================================================================
60
+
61
+ namespace micro_os_plus::micro_test_plus
62
+ {
63
+ // --------------------------------------------------------------------------
64
+ // Exceptions related comparators.
65
+
66
+ #if defined(__cpp_exceptions)
67
+
68
+ /**
69
+ * @details
70
+ * The `throws` function template verifies whether invoking the provided
71
+ * callable object results in the throwing of a specific exception type
72
+ * within the µTest++ framework. This is useful for testing error handling
73
+ * and exception safety in code under test.
74
+ *
75
+ * The function returns an output stream, allowing optional messages to be
76
+ * appended to the test report for diagnostic purposes.
77
+ */
78
+ template <class Exception_T, class Callable_T>
79
+ constexpr auto
80
+ throws (const Callable_T& func)
81
+ {
82
+ return detail::throws_<Callable_T, Exception_T>{ func };
83
+ }
84
+
85
+ /**
86
+ * @details
87
+ * The `throws` function template verifies whether invoking the provided
88
+ * callable object results in the throwing of any exception within the
89
+ * µTest++ framework. This is useful for testing general exception safety and
90
+ * ensuring that code under test properly signals error conditions.
91
+ *
92
+ * The function returns an output stream, allowing optional messages to be
93
+ * appended to the test report for diagnostic purposes.
94
+ */
95
+ template <class Callable_T>
96
+ constexpr auto
97
+ throws (const Callable_T& func)
98
+ {
99
+ return detail::throws_<Callable_T>{ func };
100
+ }
101
+
102
+ /**
103
+ * @details
104
+ * The `nothrow` function template verifies whether invoking the provided
105
+ * callable object does not result in the throwing of any exception within
106
+ * the µTest++ framework. This is useful for testing exception safety and
107
+ * ensuring that code under test does not unexpectedly signal error
108
+ * conditions.
109
+ *
110
+ * The function returns an output stream, allowing optional messages to be
111
+ * appended to the test report for diagnostic purposes.
112
+ */
113
+ template <class Callable_T>
114
+ constexpr auto
115
+ nothrow (const Callable_T& func)
116
+ {
117
+ return detail::nothrow_<Callable_T>{ func };
118
+ }
119
+
120
+ #endif // defined(__cpp_exceptions)
121
+
122
+ // --------------------------------------------------------------------------
123
+ } // namespace micro_os_plus::micro_test_plus
124
+
125
+ #if defined(__GNUC__)
126
+ #pragma GCC diagnostic pop
127
+ #endif
128
+
129
+ // ----------------------------------------------------------------------------
130
+
131
+ #endif // __cplusplus
132
+
133
+ // ----------------------------------------------------------------------------
134
+
135
+ #endif // MICRO_TEST_PLUS_EXCEPTIONS_INLINE_H_
136
+
137
+ // ----------------------------------------------------------------------------