@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,125 @@
|
|
|
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 with declarations for the µTest++ exception-checking
|
|
21
|
+
* functions.
|
|
22
|
+
*
|
|
23
|
+
* @details
|
|
24
|
+
* This header provides the declarations for the exception-checking facilities
|
|
25
|
+
* of the µTest++ framework. It exposes three function templates —
|
|
26
|
+
* `throws<Exception_T>()`, `throws()`, and `nothrow()` — which allow test
|
|
27
|
+
* cases to verify that a callable throws a specific exception, throws any
|
|
28
|
+
* exception, or throws no exception, respectively.
|
|
29
|
+
*
|
|
30
|
+
* All declarations are conditionally compiled under `__cpp_exceptions` and
|
|
31
|
+
* reside within the `micro_os_plus::micro_test_plus` namespace, ensuring
|
|
32
|
+
* clear separation from user code and minimising the risk of naming conflicts.
|
|
33
|
+
*
|
|
34
|
+
* This header is located in the top-level `include/micro-os-plus` folder.
|
|
35
|
+
* Users should include `<micro-os-plus/micro-test-plus.h>` rather than this
|
|
36
|
+
* header directly.
|
|
37
|
+
*/
|
|
38
|
+
|
|
39
|
+
#ifndef MICRO_TEST_PLUS_EXCEPTIONS_H_
|
|
40
|
+
#define MICRO_TEST_PLUS_EXCEPTIONS_H_
|
|
41
|
+
|
|
42
|
+
// ----------------------------------------------------------------------------
|
|
43
|
+
|
|
44
|
+
#ifdef __cplusplus
|
|
45
|
+
|
|
46
|
+
// ----------------------------------------------------------------------------
|
|
47
|
+
|
|
48
|
+
#if defined(__GNUC__)
|
|
49
|
+
#pragma GCC diagnostic push
|
|
50
|
+
#pragma GCC diagnostic ignored "-Waggregate-return"
|
|
51
|
+
#if defined(__clang__)
|
|
52
|
+
#pragma clang diagnostic ignored "-Wc++98-compat"
|
|
53
|
+
#endif
|
|
54
|
+
#endif
|
|
55
|
+
|
|
56
|
+
// ============================================================================
|
|
57
|
+
|
|
58
|
+
namespace micro_os_plus::micro_test_plus
|
|
59
|
+
{
|
|
60
|
+
// --------------------------------------------------------------------------
|
|
61
|
+
|
|
62
|
+
#if defined(__cpp_exceptions)
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* @ingroup micro-test-plus-exceptions
|
|
66
|
+
* @brief Check if a callable throws a specific exception.
|
|
67
|
+
*
|
|
68
|
+
* @tparam Exception_T The type of the exception expected to be thrown.
|
|
69
|
+
* @tparam Callable_T The type of the callable object to be invoked.
|
|
70
|
+
* @param [in] func The callable object to check for exception throwing
|
|
71
|
+
* behaviour.
|
|
72
|
+
* @return An output stream to write optional messages.
|
|
73
|
+
*/
|
|
74
|
+
template <class Exception_T, class Callable_T>
|
|
75
|
+
[[nodiscard]] constexpr auto
|
|
76
|
+
throws (const Callable_T& func);
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* @ingroup micro-test-plus-exceptions
|
|
80
|
+
* @brief Check if a callable throws an exception (any exception).
|
|
81
|
+
*
|
|
82
|
+
* @tparam Callable_T The type of the callable object to be invoked.
|
|
83
|
+
* @param [in] func The callable object to check for exception throwing
|
|
84
|
+
* behaviour.
|
|
85
|
+
* @return An output stream to write optional messages.
|
|
86
|
+
*/
|
|
87
|
+
template <class Callable_T>
|
|
88
|
+
[[nodiscard]] constexpr auto
|
|
89
|
+
throws (const Callable_T& func);
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* @ingroup micro-test-plus-exceptions
|
|
93
|
+
* @brief Check if a callable does not throw an exception.
|
|
94
|
+
*
|
|
95
|
+
* @tparam Callable_T The type of the callable object to be invoked.
|
|
96
|
+
* @param [in] func The callable object to check for exception safety.
|
|
97
|
+
* @return An output stream to write optional messages.
|
|
98
|
+
*/
|
|
99
|
+
template <class Callable_T>
|
|
100
|
+
[[nodiscard]] constexpr auto
|
|
101
|
+
nothrow (const Callable_T& func);
|
|
102
|
+
|
|
103
|
+
#endif
|
|
104
|
+
|
|
105
|
+
// --------------------------------------------------------------------------
|
|
106
|
+
} // namespace micro_os_plus::micro_test_plus
|
|
107
|
+
|
|
108
|
+
#if defined(__GNUC__)
|
|
109
|
+
#pragma GCC diagnostic pop
|
|
110
|
+
#endif
|
|
111
|
+
|
|
112
|
+
// ----------------------------------------------------------------------------
|
|
113
|
+
|
|
114
|
+
#endif // __cplusplus
|
|
115
|
+
|
|
116
|
+
// ============================================================================
|
|
117
|
+
// Templates & constexpr implementations.
|
|
118
|
+
|
|
119
|
+
#include "inlines/exceptions-inline.h"
|
|
120
|
+
|
|
121
|
+
// ----------------------------------------------------------------------------
|
|
122
|
+
|
|
123
|
+
#endif // MICRO_TEST_PLUS_EXCEPTIONS_H_
|
|
124
|
+
|
|
125
|
+
// ----------------------------------------------------------------------------
|