@micro-os-plus/micro-test-plus 3.2.2 → 3.3.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/.cmake-format.yaml +11 -0
- package/CHANGELOG.md +417 -2
- package/CMakeLists.txt +33 -30
- package/LICENSE +1 -1
- package/README.md +1 -1
- package/{xcdl.json → config/xcdl-build.json} +6 -6
- package/include/micro-os-plus/micro-test-plus/detail.h +1908 -0
- package/include/micro-os-plus/micro-test-plus/function-comparators.h +333 -0
- package/include/micro-os-plus/micro-test-plus/inlines/details-inlines.h +172 -0
- package/include/micro-os-plus/micro-test-plus/inlines/function-comparators-inlines.h +341 -0
- package/include/micro-os-plus/micro-test-plus/inlines/literals-inlines.h +604 -0
- package/include/micro-os-plus/micro-test-plus/inlines/math-inlines.h +315 -0
- package/include/micro-os-plus/micro-test-plus/inlines/micro-test-plus-inlines.h +313 -0
- package/include/micro-os-plus/micro-test-plus/inlines/reflection-inlines.h +170 -0
- package/include/micro-os-plus/micro-test-plus/inlines/test-reporter-inlines.h +476 -0
- package/include/micro-os-plus/micro-test-plus/inlines/test-suite-inlines.h +115 -0
- package/include/micro-os-plus/micro-test-plus/literals.h +912 -0
- package/include/micro-os-plus/micro-test-plus/math.h +217 -0
- package/include/micro-os-plus/micro-test-plus/operators.h +514 -0
- package/include/micro-os-plus/micro-test-plus/reflection.h +233 -0
- package/include/micro-os-plus/micro-test-plus/test-reporter-basic.h +289 -0
- package/include/micro-os-plus/micro-test-plus/test-reporter-tap.h +281 -0
- package/include/micro-os-plus/micro-test-plus/test-reporter.h +846 -0
- package/include/micro-os-plus/micro-test-plus/test-runner.h +281 -0
- package/include/micro-os-plus/micro-test-plus/test-suite.h +492 -0
- package/include/micro-os-plus/micro-test-plus/type-traits.h +1148 -0
- package/include/micro-os-plus/micro-test-plus.h +172 -552
- package/meson.build +7 -5
- package/package.json +29 -34
- package/src/micro-test-plus.cpp +134 -37
- package/src/test-reporter-basic.cpp +466 -0
- package/src/test-reporter-tap.cpp +530 -0
- package/src/test-reporter.cpp +207 -240
- package/src/test-runner.cpp +135 -23
- package/src/test-suite.cpp +182 -10
- package/include/micro-os-plus/detail.h +0 -765
- package/include/micro-os-plus/inlines.h +0 -209
- package/include/micro-os-plus/literals.h +0 -512
- package/include/micro-os-plus/math.h +0 -204
- package/include/micro-os-plus/reflection.h +0 -139
- package/include/micro-os-plus/test-reporter-inlines.h +0 -230
- package/include/micro-os-plus/test-reporter.h +0 -356
- package/include/micro-os-plus/test-runner.h +0 -132
- package/include/micro-os-plus/test-suite.h +0 -306
- package/include/micro-os-plus/type-traits.h +0 -389
|
@@ -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
|
+
// ----------------------------------------------------------------------------
|