@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
@@ -0,0 +1,217 @@
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++ mathematical
21
+ * utilities.
22
+ *
23
+ * @details
24
+ * This header provides the declarations for the mathematical utility templates
25
+ * used within the µTest++ framework. It defines interfaces for a suite of
26
+ * constexpr mathematical functions, including absolute value, minimum value
27
+ * selection, exponentiation, and compile-time parsing of numeric values from
28
+ * character sequences.
29
+ *
30
+ * These utilities are designed to be lightweight and suitable for embedded
31
+ * environments, supporting both integral and floating-point types, and
32
+ * enabling expressive, type-safe, and efficient compile-time computations.
33
+ * Special attention is given to constexpr compatibility and minimal reliance
34
+ * on the standard library, ensuring portability and performance across a wide
35
+ * range of platforms.
36
+ *
37
+ * All definitions reside within the `micro_os_plus::micro_test_plus::math`
38
+ * namespace, ensuring clear separation from user code and minimising the risk
39
+ * of naming conflicts.
40
+ *
41
+ * The header files are organised within the
42
+ * `include/micro-os-plus/micro-test-plus` folder to maintain a structured and
43
+ * modular codebase.
44
+ *
45
+ * This file is intended solely for internal use within the framework and
46
+ * should not be included directly by user code.
47
+ */
48
+
49
+ #ifndef MICRO_TEST_PLUS_MATH_H_
50
+ #define MICRO_TEST_PLUS_MATH_H_
51
+
52
+ // ----------------------------------------------------------------------------
53
+
54
+ #ifdef __cplusplus
55
+
56
+ // ----------------------------------------------------------------------------
57
+
58
+ #include <array>
59
+
60
+ // ----------------------------------------------------------------------------
61
+
62
+ #if defined(__GNUC__)
63
+ #pragma GCC diagnostic push
64
+ #pragma GCC diagnostic ignored "-Wconversion"
65
+ #if defined(__clang__)
66
+ #pragma clang diagnostic ignored "-Wc++98-compat"
67
+ #endif
68
+ #endif
69
+
70
+ namespace micro_os_plus::micro_test_plus
71
+ {
72
+ // --------------------------------------------------------------------------
73
+
74
+ /**
75
+ * @namespace micro_os_plus::micro_test_plus::math
76
+ * @brief Mathematical utilities for the µTest++ testing framework.
77
+ *
78
+ * @details
79
+ * The `math` namespace offers a suite of constexpr mathematical
80
+ * function templates and utilities for use within the µTest++ framework.
81
+ *
82
+ * These functions include generic implementations for absolute value,
83
+ * minimum value, exponentiation, and compile-time parsing of numeric values
84
+ * from character arrays. The utilities are designed to be lightweight and
85
+ * suitable for embedded environments, where standard library alternatives
86
+ * may be unavailable, less efficient, or not constexpr.
87
+ *
88
+ * All definitions within this namespace are intended to facilitate
89
+ * mathematical operations in a type-safe and efficient manner, and are
90
+ * implemented in the `include/micro-os-plus` folder to maintain a structured
91
+ * and modular codebase.
92
+ */
93
+ namespace math
94
+ {
95
+ /**
96
+ * @brief Computes the absolute value of a given comparable value.
97
+ *
98
+ * @tparam T The type of the input value. Must support comparison and unary
99
+ * negation.
100
+ *
101
+ * @param t The value for which the absolute value is to be computed.
102
+ * @return The absolute value of the input.
103
+ */
104
+ template <class T>
105
+ [[nodiscard]] constexpr auto
106
+ abs (const T t) -> T;
107
+
108
+ /**
109
+ * @brief Computes the minimum of two comparable values.
110
+ *
111
+ * @tparam T The type of the input values. Must support comparison via the
112
+ * `<` operator.
113
+ *
114
+ * @param lhs The first value to compare.
115
+ * @param rhs The second value to compare.
116
+ * @return A reference to the minimum of the two input values.
117
+ */
118
+ template <class T>
119
+ [[nodiscard]] constexpr auto
120
+ min_value (const T& lhs, const T& rhs) -> const T&;
121
+
122
+ /**
123
+ * @brief Generic exponentiation function to compute the power of a base
124
+ * raised to an exponent.
125
+ *
126
+ * @tparam T The type of the base value. Must support multiplication and
127
+ * construction from an integer.
128
+ * @tparam Exp_T The type of the exponent. Must support subtraction and
129
+ * comparison to zero.
130
+ *
131
+ * @param base The base value to be raised to the power of \p exp.
132
+ * @param exp The exponent value.
133
+ * @return The result of raising \p base to the power of \p exp.
134
+ */
135
+ template <class T, class Exp_T>
136
+ [[nodiscard]] constexpr auto
137
+ pow (const T base, const Exp_T exp) -> T;
138
+
139
+ /**
140
+ * @brief Computes the integral value of a number represented as an array
141
+ * of characters.
142
+ *
143
+ * @tparam T The target integral type for the result.
144
+ * @tparam Cs The character pack representing the numeric value.
145
+ *
146
+ * @par Parameters
147
+ * None.
148
+ * @return The parsed integral value of type \c T.
149
+ */
150
+ template <class T, char... Cs>
151
+ [[nodiscard]] constexpr auto
152
+ num (void) -> T;
153
+
154
+ /**
155
+ * @brief Computes the decimal part of a number represented as an array of
156
+ * characters.
157
+ *
158
+ * @tparam T The target integral type for the result.
159
+ * @tparam Cs The character pack representing the numeric value.
160
+ *
161
+ * @par Parameters
162
+ * None.
163
+ * @return The parsed decimal part as an integral value of type \c T.
164
+ */
165
+ template <class T, char... Cs>
166
+ [[nodiscard]] constexpr auto
167
+ den (void) -> T;
168
+
169
+ /**
170
+ * @brief Computes the number of decimal places in a number represented as
171
+ * an array of characters.
172
+ *
173
+ * @tparam T The integral type for the result.
174
+ * @tparam Cs The character pack representing the numeric value.
175
+ *
176
+ * @par Parameters
177
+ * None.
178
+ * @return The number of decimal places as a value of type \c T.
179
+ */
180
+ template <class T, char... Cs>
181
+ [[nodiscard]] constexpr auto
182
+ den_size (void) -> T;
183
+
184
+ /**
185
+ * @brief Computes the number of decimal places of a value, up to 7 digits.
186
+ *
187
+ * @tparam T The integral type for the result.
188
+ * @tparam Value_T The type of the input value, typically a floating-point
189
+ * type.
190
+ *
191
+ * @param value The value whose decimal precision is to be determined.
192
+ * @return The number of decimal places, as a value of type \c T, up to a
193
+ * maximum of seven.
194
+ */
195
+ template <class T, class Value_T>
196
+ [[nodiscard]] constexpr auto
197
+ den_size (Value_T value) -> T;
198
+
199
+ // ------------------------------------------------------------------------
200
+ } // namespace math
201
+
202
+ // --------------------------------------------------------------------------
203
+ } // namespace micro_os_plus::micro_test_plus
204
+
205
+ #if defined(__GNUC__)
206
+ #pragma GCC diagnostic pop
207
+ #endif
208
+
209
+ // ----------------------------------------------------------------------------
210
+
211
+ #endif // __cplusplus
212
+
213
+ // ----------------------------------------------------------------------------
214
+
215
+ #endif // MICRO_TEST_PLUS_MATH_H_
216
+
217
+ // ----------------------------------------------------------------------------