@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,115 @@
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++ test
21
+ * suite.
22
+ *
23
+ * @details
24
+ * This header provides the inline implementations for the test suite
25
+ * facilities used within the µTest++ framework. It defines the logic for
26
+ * constructing and registering test suites, including the binding of callable
27
+ * objects and their arguments for flexible test suite definitions.
28
+ *
29
+ * The implementation ensures that each test suite is automatically registered
30
+ * with the global test runner upon construction, enabling automated discovery
31
+ * and execution of test suites. The use of `std::bind` allows for versatile
32
+ * test suite initialisation with arbitrary callable types and arguments.
33
+ *
34
+ * All definitions reside within the `micro_os_plus::micro_test_plus`
35
+ * namespace, maintaining a clear separation from user code and minimising the
36
+ * risk of naming conflicts.
37
+ *
38
+ * The header files are organised within the
39
+ * `include/micro-os-plus/micro-test-plus` folder to maintain a structured and
40
+ * modular codebase.
41
+ *
42
+ * This file is intended solely for internal use within the framework and
43
+ * should not be included directly by user code.
44
+ */
45
+
46
+ #ifndef MICRO_TEST_PLUS_TEST_SUITE_INLINES_H_
47
+ #define MICRO_TEST_PLUS_TEST_SUITE_INLINES_H_
48
+
49
+ // ----------------------------------------------------------------------------
50
+
51
+ #ifdef __cplusplus
52
+
53
+ // ----------------------------------------------------------------------------
54
+
55
+ #include <stdio.h>
56
+ #include <cstring>
57
+ // #include "test-runner.h"
58
+
59
+ // ----------------------------------------------------------------------------
60
+
61
+ #if defined(__GNUC__)
62
+ #pragma GCC diagnostic push
63
+ #pragma GCC diagnostic ignored "-Waggregate-return"
64
+ #if defined(__clang__)
65
+ #pragma clang diagnostic ignored "-Wc++98-compat"
66
+ #pragma clang diagnostic ignored "-Wc++98-compat-pedantic"
67
+ #endif
68
+ #endif
69
+
70
+ namespace micro_os_plus::micro_test_plus
71
+ {
72
+ // --------------------------------------------------------------------------
73
+
74
+ extern test_runner runner;
75
+
76
+ // --------------------------------------------------------------------------
77
+
78
+ /**
79
+ * @details
80
+ * This constructor initialises a test suite by binding the provided callable
81
+ * and its arguments, and registers the suite with the test runner.
82
+ *
83
+ * The callable is bound using `std::bind`, allowing for flexible test suite
84
+ * definitions with arbitrary arguments. Upon construction, the test suite is
85
+ * automatically registered with the global runner for execution.
86
+ */
87
+ template <typename Callable_T, typename... Args_T>
88
+ test_suite::test_suite (const char* name, Callable_T&& callable,
89
+ Args_T&&... arguments)
90
+ : test_suite_base{ name },
91
+ callable_{ std::bind (callable, arguments...) }
92
+ {
93
+ #if defined(MICRO_OS_PLUS_TRACE_MICRO_TEST_PLUS)
94
+ printf ("%s\n", __PRETTY_FUNCTION__);
95
+ #endif // MICRO_OS_PLUS_TRACE_MICRO_TEST_PLUS
96
+
97
+ runner.register_test_suite (this);
98
+ }
99
+
100
+ // --------------------------------------------------------------------------
101
+ } // namespace micro_os_plus::micro_test_plus
102
+
103
+ #if defined(__GNUC__)
104
+ #pragma GCC diagnostic pop
105
+ #endif
106
+
107
+ // ----------------------------------------------------------------------------
108
+
109
+ #endif // __cplusplus
110
+
111
+ // ----------------------------------------------------------------------------
112
+
113
+ #endif // MICRO_TEST_PLUS_TEST_SUITE_INLINES_H_
114
+
115
+ // ----------------------------------------------------------------------------