@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.
- package/CHANGELOG.md +412 -2
- package/CMakeLists.txt +134 -28
- package/README.md +3 -2
- package/config/xcdl-build.json +11 -4
- package/include/micro-os-plus/micro-test-plus/README.md +6 -0
- package/include/micro-os-plus/micro-test-plus/deferred-reporter.h +267 -0
- package/include/micro-os-plus/micro-test-plus/detail.h +272 -1425
- package/include/micro-os-plus/micro-test-plus/exceptions.h +125 -0
- package/include/micro-os-plus/micro-test-plus/expression-formatter.h +669 -0
- package/include/micro-os-plus/micro-test-plus/function-comparators.h +15 -7
- package/include/micro-os-plus/micro-test-plus/inlines/{details-inlines.h → deferred-reporter-inlines.h} +66 -44
- package/include/micro-os-plus/micro-test-plus/inlines/detail-inlines.h +711 -0
- package/include/micro-os-plus/micro-test-plus/inlines/exceptions-inline.h +137 -0
- package/include/micro-os-plus/micro-test-plus/inlines/{test-reporter-inlines.h → expression-formatter-inlines.h} +232 -198
- package/include/micro-os-plus/micro-test-plus/inlines/function-comparators-inlines.h +24 -20
- package/include/micro-os-plus/micro-test-plus/inlines/literals-inlines.h +50 -31
- package/include/micro-os-plus/micro-test-plus/inlines/math-inlines.h +25 -19
- package/include/micro-os-plus/micro-test-plus/inlines/operators-inlines.h +275 -0
- package/include/micro-os-plus/micro-test-plus/inlines/reflection-inlines.h +39 -21
- package/include/micro-os-plus/micro-test-plus/inlines/reporter-inlines.h +205 -0
- package/include/micro-os-plus/micro-test-plus/inlines/runner-inlines.h +151 -0
- package/include/micro-os-plus/micro-test-plus/inlines/runner-totals-inlines.h +152 -0
- package/include/micro-os-plus/micro-test-plus/inlines/test-inlines.h +555 -0
- package/include/micro-os-plus/micro-test-plus/inlines/timings-inlines.h +120 -0
- package/include/micro-os-plus/micro-test-plus/inlines/type-traits-inlines.h +231 -0
- package/include/micro-os-plus/micro-test-plus/inlines/utility-inlines.h +126 -0
- package/include/micro-os-plus/micro-test-plus/literals.h +12 -17
- package/include/micro-os-plus/micro-test-plus/math.h +14 -6
- package/include/micro-os-plus/micro-test-plus/operators.h +53 -209
- package/include/micro-os-plus/micro-test-plus/reflection.h +8 -4
- package/include/micro-os-plus/micro-test-plus/{test-reporter-basic.h → reporter-human.h} +80 -74
- package/include/micro-os-plus/micro-test-plus/{test-reporter-tap.h → reporter-tap.h} +77 -71
- package/include/micro-os-plus/micro-test-plus/reporter.h +619 -0
- package/include/micro-os-plus/micro-test-plus/runner-totals.h +250 -0
- package/include/micro-os-plus/micro-test-plus/runner.h +472 -0
- package/include/micro-os-plus/micro-test-plus/test.h +1013 -0
- package/include/micro-os-plus/micro-test-plus/timings.h +363 -0
- package/include/micro-os-plus/micro-test-plus/type-traits.h +223 -577
- package/include/micro-os-plus/micro-test-plus/utility.h +136 -0
- package/include/micro-os-plus/micro-test-plus.h +42 -236
- package/meson.build +11 -6
- package/package.json +11 -3
- package/src/deferred-reporter.cpp +137 -0
- package/src/expression-formatter.cpp +289 -0
- package/src/reflection.cpp +97 -0
- package/src/reporter-human.cpp +816 -0
- package/src/reporter-tap.cpp +772 -0
- package/src/reporter.cpp +481 -0
- package/src/runner-totals.cpp +98 -0
- package/src/runner.cpp +669 -0
- package/src/test.cpp +503 -0
- package/src/timings.cpp +210 -0
- package/src/utility.cpp +163 -0
- package/.cmake-format.yaml +0 -11
- package/include/micro-os-plus/micro-test-plus/inlines/micro-test-plus-inlines.h +0 -313
- package/include/micro-os-plus/micro-test-plus/inlines/test-suite-inlines.h +0 -115
- package/include/micro-os-plus/micro-test-plus/test-reporter.h +0 -846
- package/include/micro-os-plus/micro-test-plus/test-runner.h +0 -281
- package/include/micro-os-plus/micro-test-plus/test-suite.h +0 -492
- package/src/micro-test-plus.cpp +0 -316
- package/src/test-reporter-basic.cpp +0 -466
- package/src/test-reporter-tap.cpp +0 -530
- package/src/test-reporter.cpp +0 -399
- package/src/test-runner.cpp +0 -311
- 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
|
+
// ----------------------------------------------------------------------------
|