@micro-os-plus/micro-test-plus 3.0.1 → 3.0.2
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 +13 -0
- package/README.md +104 -89
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,19 @@ Please check
|
|
|
6
6
|
[GitHub](https://github.com/micro-os-plus/micro-test-plus-xpack/issues/)
|
|
7
7
|
and close existing issues and pull requests.
|
|
8
8
|
|
|
9
|
+
## 2022-04-19
|
|
10
|
+
|
|
11
|
+
* 3.0.2
|
|
12
|
+
* cd697a4 README reworks
|
|
13
|
+
|
|
14
|
+
## 2022-04-10
|
|
15
|
+
|
|
16
|
+
* d53ee24 package.json: bump build-helper 2.7.1
|
|
17
|
+
|
|
18
|
+
## 2022-04-07
|
|
19
|
+
|
|
20
|
+
* b43ce71 test-all.yml: remove Raspberry Pi OS test
|
|
21
|
+
|
|
9
22
|
## 2022-04-05
|
|
10
23
|
|
|
11
24
|
* 3.0.1
|
package/README.md
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
[](https://github.com/micro-os-plus/micro-test-plus-xpack/blob/xpack/LICENSE)
|
|
2
2
|
[](https://github.com/micro-os-plus/micro-test-plus-xpack/actions?query=workflow%3A%22CI+on+Push%22)
|
|
3
3
|
|
|
4
|
-
# A source library xPack with µTest++, a testing framework for embedded platforms
|
|
4
|
+
# A source library xPack with µTest++, a lightweight testing framework for embedded platforms
|
|
5
5
|
|
|
6
|
-
The **µTest++** project (_micro test plus_) provides a
|
|
6
|
+
The **µTest++** project (_micro test plus_) provides a small memory footprint
|
|
7
7
|
testing framework, intended for running unit tests on embedded
|
|
8
8
|
platforms.
|
|
9
9
|
|
|
@@ -49,14 +49,16 @@ ls -l xpacks/micro-os-plus-micro-test-plus
|
|
|
49
49
|
### Git submodule
|
|
50
50
|
|
|
51
51
|
If, for any reason, **xpm** is not available, the next recommended
|
|
52
|
-
solution is to link it as a Git submodule below an `xpacks`
|
|
52
|
+
solution is to link it as a Git submodule, preferably below an `xpacks`
|
|
53
|
+
folder.
|
|
53
54
|
|
|
54
55
|
```sh
|
|
55
56
|
cd my-project
|
|
56
57
|
git init # Unless already a Git project
|
|
57
58
|
mkdir -p xpacks
|
|
58
59
|
|
|
59
|
-
git submodule add
|
|
60
|
+
git submodule add \
|
|
61
|
+
https://github.com/micro-os-plus/micro-test-plus-xpack.git \
|
|
60
62
|
xpacks/micro-os-plus-micro-test-plus
|
|
61
63
|
```
|
|
62
64
|
|
|
@@ -75,14 +77,14 @@ into `xpack`.
|
|
|
75
77
|
|
|
76
78
|
## Developer info
|
|
77
79
|
|
|
78
|
-
The xPack Build
|
|
79
|
-
testing frameworks:
|
|
80
|
+
The xPack Build Framework already includes ready to use
|
|
81
|
+
support for several testing frameworks:
|
|
80
82
|
|
|
81
83
|
- [Google Test](https://github.com/xpack-3rd-party/googletest-xpack)
|
|
82
84
|
- [Catch2](https://github.com/xpack-3rd-party/catch2-xpack)
|
|
83
|
-
- [Boost UT](https://github.com/xpack-3rd-party/boost-ut-xpack)
|
|
85
|
+
- [Boost UT](https://github.com/xpack-3rd-party/boost-ut-xpack)
|
|
84
86
|
|
|
85
|
-
However, they all are quite heavy in terms of memory resources
|
|
87
|
+
However, they all are quite heavy in terms of memory resources; also the
|
|
86
88
|
learning curve for mastering them is quite steep.
|
|
87
89
|
|
|
88
90
|
Thus, for embedded projects, a simpler solution, with a smaller
|
|
@@ -97,35 +99,38 @@ The later v3.x was a full rework inspired by
|
|
|
97
99
|
|
|
98
100
|
The main characteristics of µTest++, basically inherited from Boost UT, are:
|
|
99
101
|
|
|
100
|
-
- intended to test both C and C
|
|
102
|
+
- intended to test **both C and C++** projects
|
|
101
103
|
- modern C++ 20 code (this was also the reason
|
|
102
104
|
to raise the bar to C++ 20 for the entire µOS++ project)
|
|
103
|
-
- macro free (while preserving the nice feature of being able to report
|
|
105
|
+
- **macro free** (while preserving the nice feature of being able to report
|
|
104
106
|
the file name and line number for failed tests)
|
|
105
|
-
- expectations
|
|
106
|
-
- test cases
|
|
107
|
+
- **expectations**, **assumptions**, **exceptions**
|
|
108
|
+
- **test cases**, **test suites**
|
|
107
109
|
- automatic test suites registration
|
|
108
110
|
|
|
109
111
|
As major differentiator from Boost UT:
|
|
110
112
|
|
|
111
|
-
- reduced memory footprint
|
|
113
|
+
- **reduced memory footprint**, since there are no dependencies on
|
|
112
114
|
the standard C++ stream library
|
|
113
|
-
- a slightly simplified API
|
|
115
|
+
- a slightly **simplified API**
|
|
114
116
|
|
|
115
117
|
### Concepts and features
|
|
116
118
|
|
|
117
119
|
- for complex applications, test cases can be grouped in test suites
|
|
118
|
-
- test suites can be located in separate compilation units
|
|
120
|
+
- test suites can be located in separate compilation units; they automatically
|
|
119
121
|
register themselves to the runner;
|
|
120
|
-
- a test suite is a named sequence of test cases;
|
|
121
|
-
- a test case is a sequence of test conditions
|
|
122
|
-
|
|
122
|
+
- a **test suite** is a named sequence of test cases;
|
|
123
|
+
- a **test case** is a sequence of **test conditions**
|
|
124
|
+
(or simply **tests**, or **checks**),
|
|
125
|
+
which are expectations/assumptions,
|
|
126
|
+
i.e. conditions expected to be true;
|
|
123
127
|
- tests are based on logical expressions, which usually
|
|
124
128
|
compute a result and compare it to an expected value
|
|
125
129
|
- for C++ projects: it is also possible to check if, while evaluating
|
|
126
|
-
an expression, exceptions are thrown or not;
|
|
127
|
-
- each test either succeeds or fails;
|
|
128
|
-
-
|
|
130
|
+
an expression, **exceptions** are thrown or not;
|
|
131
|
+
- each test either succeeds or fails;
|
|
132
|
+
- for **expectations**, the runner keeps counts of them;
|
|
133
|
+
- **assumptions** are hard conditions expected to be true in order for the test
|
|
129
134
|
to be able to run;
|
|
130
135
|
- failed assumptions abort the test;
|
|
131
136
|
- the test progress is shown on STDOUT, with each tests on a
|
|
@@ -136,7 +141,7 @@ As major differentiator from Boost UT:
|
|
|
136
141
|
exit code.
|
|
137
142
|
|
|
138
143
|
A test suite is considered successful
|
|
139
|
-
if there is at least one successful
|
|
144
|
+
if there is at least one successful expectation
|
|
140
145
|
and there are no failed tests.
|
|
141
146
|
|
|
142
147
|
If all tests suites are successful, the process returns 0 as exit value.
|
|
@@ -146,13 +151,13 @@ If all tests suites are successful, the process returns 0 as exit value.
|
|
|
146
151
|
The **International Software Testing Qualification Board** defines some terms
|
|
147
152
|
used in testing frameworks:
|
|
148
153
|
|
|
149
|
-
- test condition
|
|
154
|
+
- **test condition**: a testable aspect of a component or system identified
|
|
150
155
|
as a basis for testing (implemented in µTest++ as calls to `expect()` or
|
|
151
156
|
`assume()` functions);
|
|
152
|
-
- test case
|
|
157
|
+
- **test case**: a set of preconditions, inputs, actions (where applicable),
|
|
153
158
|
expected results and postconditions, developed based on test conditions
|
|
154
159
|
(implemented in µTest++ as calls to the `test_case()` function)
|
|
155
|
-
- test suite
|
|
160
|
+
- **test suite**: a set of test scripts or test procedures to be executed in
|
|
156
161
|
a specific test run (implemented in µTest++ as instances of the
|
|
157
162
|
`test_suite` class).
|
|
158
163
|
|
|
@@ -184,11 +189,11 @@ main(int argc, char* argv[])
|
|
|
184
189
|
When running this test, the output looks like:
|
|
185
190
|
|
|
186
191
|
```console
|
|
187
|
-
Minimal - test suite started
|
|
192
|
+
• Minimal - test suite started
|
|
188
193
|
|
|
189
194
|
✓ Check truth - test case passed (1 check)
|
|
190
195
|
|
|
191
|
-
Minimal - test suite passed (1 check in 1 test case)
|
|
196
|
+
✓ Minimal - test suite passed (1 check in 1 test case)
|
|
192
197
|
```
|
|
193
198
|
|
|
194
199
|
A slightly more useful example would check the result of a computed value;
|
|
@@ -211,7 +216,7 @@ main(int argc, char* argv[])
|
|
|
211
216
|
initialize(argc, argv, "The Answer");
|
|
212
217
|
|
|
213
218
|
test_case ("Check answer", [] {
|
|
214
|
-
expect (compute_answer() == 42
|
|
219
|
+
expect (compute_answer() == 42) << "answer is 42";
|
|
215
220
|
});
|
|
216
221
|
|
|
217
222
|
return exit_code ();
|
|
@@ -219,14 +224,14 @@ main(int argc, char* argv[])
|
|
|
219
224
|
```
|
|
220
225
|
|
|
221
226
|
```console
|
|
222
|
-
The Answer - test suite started
|
|
227
|
+
• The Answer - test suite started
|
|
223
228
|
|
|
224
229
|
✓ Check answer - test case passed (1 check)
|
|
225
230
|
|
|
226
|
-
The Answer - test suite passed (1 check passed, 0 checks failed, in 1 test case)
|
|
231
|
+
✓ The Answer - test suite passed (1 check passed, 0 checks failed, in 1 test case)
|
|
227
232
|
```
|
|
228
233
|
|
|
229
|
-
In case
|
|
234
|
+
In case the function returns the wrong answer, the test will fail;
|
|
230
235
|
for example:
|
|
231
236
|
|
|
232
237
|
```c++
|
|
@@ -240,20 +245,20 @@ compute_answer()
|
|
|
240
245
|
In this case the test will fail with:
|
|
241
246
|
|
|
242
247
|
```console
|
|
243
|
-
The Answer - test suite started
|
|
248
|
+
• The Answer - test suite started
|
|
244
249
|
|
|
245
250
|
• Check answer - test case started
|
|
246
251
|
✗ answer is 42 FAILED (answer.cpp:17)
|
|
247
252
|
✗ Check answer - test case FAILED (0 checks passed, 1 check failed)
|
|
248
253
|
|
|
249
|
-
The Answer - test suite FAILED (0 checks passed, 1 check failed, in 1 test case)
|
|
254
|
+
✗ The Answer - test suite FAILED (0 checks passed, 1 check failed, in 1 test case)
|
|
250
255
|
```
|
|
251
256
|
|
|
252
257
|
The output identifies the failed test as located at line 17, but does not
|
|
253
258
|
provide more details, for example it does not tell what was the actual
|
|
254
259
|
wrong answer.
|
|
255
260
|
|
|
256
|
-
To get such useful information, the test should be slightly more elaborate,
|
|
261
|
+
To get such a useful information, the test should be slightly more elaborate,
|
|
257
262
|
and must use some custom comparators or operators; for example:
|
|
258
263
|
|
|
259
264
|
```c++
|
|
@@ -285,7 +290,7 @@ main(int argc, char* argv[])
|
|
|
285
290
|
The result would look like:
|
|
286
291
|
|
|
287
292
|
```console
|
|
288
|
-
The Answer - test suite started
|
|
293
|
+
• The Answer - test suite started
|
|
289
294
|
|
|
290
295
|
• Check answer with comparator - test case started
|
|
291
296
|
✗ answer is 42 FAILED (answer.cpp:17, 43 == 42)
|
|
@@ -296,24 +301,27 @@ The Answer - test suite started
|
|
|
296
301
|
✗ answer is 42 FAILED (answer.cpp:25, 43 == 42)
|
|
297
302
|
✗ Check answer with operator - test case FAILED (0 checks passed, 1 check failed)
|
|
298
303
|
|
|
299
|
-
The Answer - test suite FAILED (0 checks passed, 3 checks failed, in 2 test cases)
|
|
304
|
+
✗ The Answer - test suite FAILED (0 checks passed, 3 checks failed, in 2 test cases)
|
|
300
305
|
```
|
|
301
306
|
|
|
302
307
|
In the first case, `eq()` is a function that basically compares almost
|
|
303
|
-
everything and is able to keep track of its operands.
|
|
304
|
-
functions for all comparisons.
|
|
308
|
+
everything and is able to keep track of the values of its operands.
|
|
309
|
+
There are similar functions for all comparisons.
|
|
305
310
|
|
|
306
311
|
In the second case, a custom operator is used. To avoid interferences
|
|
307
|
-
with other operators,
|
|
308
|
-
|
|
312
|
+
with other operators, this custom operator is defined in a separate namespace
|
|
313
|
+
(which must
|
|
314
|
+
be explicitly referred to as shown) and matches only operands of
|
|
315
|
+
some specific types.
|
|
309
316
|
|
|
310
|
-
To cast the integer constant `42` to
|
|
317
|
+
To cast the integer constant `42` to such a specific type, a custom literal
|
|
311
318
|
is available (`_i`), which is also defined in a separate namespace.
|
|
312
319
|
|
|
313
320
|
In addition to literals used to define constants, there are also definitions
|
|
314
321
|
which can be used to cast expressions.
|
|
315
322
|
|
|
316
|
-
For the
|
|
323
|
+
For the custom operators to match, it is necessary for at least one of
|
|
324
|
+
the operands
|
|
317
325
|
to be of the specific type, usually the constant using a literal, but if both
|
|
318
326
|
are expression, at least one of them must be casted.
|
|
319
327
|
|
|
@@ -337,7 +345,8 @@ a boolean or use custom comparators/operators derived from an
|
|
|
337
345
|
internal `detail::op` type.
|
|
338
346
|
|
|
339
347
|
For generic checks performed outside the testing framework, the results can
|
|
340
|
-
be reported with `expect(true)` or `expect(false)
|
|
348
|
+
be reported with `expect(true)` or `expect(false)` (see the example testing
|
|
349
|
+
multiple exceptions below).
|
|
341
350
|
|
|
342
351
|
#### Assumptions
|
|
343
352
|
|
|
@@ -349,12 +358,12 @@ bool assume(const Expr_T& expr);
|
|
|
349
358
|
```
|
|
350
359
|
|
|
351
360
|
Similarly, the template matches only expressions that evaluate to
|
|
352
|
-
a boolean
|
|
361
|
+
a boolean and use custom comparators/operators derived from a
|
|
353
362
|
internal `detail::op` type.
|
|
354
363
|
|
|
355
364
|
#### Function comparators
|
|
356
365
|
|
|
357
|
-
Expectations and assumptions
|
|
366
|
+
Expectations and assumptions can test any expression evaluating to a
|
|
358
367
|
boolean value, but in order to nicely report the difference between expected
|
|
359
368
|
and actual values in failed
|
|
360
369
|
conditions, the following generic comparators are available:
|
|
@@ -408,7 +417,8 @@ actual values compared during the test; for example:
|
|
|
408
417
|
### Logical function operators
|
|
409
418
|
|
|
410
419
|
Complex expressions can be checked in a single line, using the logical
|
|
411
|
-
`_and()`, `_or()` and `_not()` functions. The names are prefixed
|
|
420
|
+
`_and()`, `_or()` and `_not()` functions. The names are prefixed with
|
|
421
|
+
underscore since
|
|
412
422
|
`and`, `or` and `not` are reserved words in C/C++.
|
|
413
423
|
|
|
414
424
|
```c++
|
|
@@ -436,15 +446,15 @@ as shown below.
|
|
|
436
446
|
In C/C++, plain strings are actually pointers to characters, and simply
|
|
437
447
|
comparing them does not compare the content but the memory addresses.
|
|
438
448
|
|
|
439
|
-
For string comparisons to compare the content, use `string_view
|
|
449
|
+
For string comparisons to compare the content, use `string_view` objects:
|
|
440
450
|
|
|
441
451
|
```c++
|
|
442
452
|
#include <string_view>
|
|
443
453
|
using namespace std::literals; // For the "sv" literal.
|
|
444
454
|
// ...
|
|
445
455
|
|
|
446
|
-
expect (eq (std::string_view{ compute_ultimate_answer () }, "
|
|
447
|
-
<< "ultimate_answer is '
|
|
456
|
+
expect (eq (std::string_view{ compute_ultimate_answer () }, "forty-two"sv))
|
|
457
|
+
<< "ultimate_answer is 'forty-two'";
|
|
448
458
|
```
|
|
449
459
|
|
|
450
460
|
#### Comparing containers
|
|
@@ -539,8 +549,8 @@ using namespace std::literals; // For the "sv" literal.
|
|
|
539
549
|
test_case ("Operators", [] {
|
|
540
550
|
using namespace micro_test_plus::operators;
|
|
541
551
|
|
|
542
|
-
expect (std::string_view{ compute_ultimate_answer () } == "
|
|
543
|
-
<< "ultimate answer == '
|
|
552
|
+
expect (std::string_view{ compute_ultimate_answer () } == "forty-two"sv)
|
|
553
|
+
<< "ultimate answer == 'forty-two'";
|
|
544
554
|
|
|
545
555
|
expect (std::vector<int>{ 1, 2 } == std::vector<int>{ 1, 2 })
|
|
546
556
|
<< "vector{ 1, 2 } == vector{ 1, 2 }";
|
|
@@ -654,8 +664,8 @@ expect (_f {expression} == 42_f);
|
|
|
654
664
|
|
|
655
665
|
#### Function comparators vs. operators & literals
|
|
656
666
|
|
|
657
|
-
|
|
658
|
-
overloaded operators
|
|
667
|
+
Which to use, functions like `eq()` or the
|
|
668
|
+
overloaded operators? A very good question!
|
|
659
669
|
|
|
660
670
|
Functions guarantee that the nice feature of showing the actual values
|
|
661
671
|
when expectations fail is always available. Also the syntax is more on the
|
|
@@ -666,9 +676,11 @@ but require the hack with the type wrappers and literals to enforce the
|
|
|
666
676
|
types, otherwise the actual values will not be displayed when the
|
|
667
677
|
expectations fail.
|
|
668
678
|
|
|
669
|
-
Both syntaxes are functional, and, once
|
|
679
|
+
Both syntaxes are functional, and, once the differences understood,
|
|
670
680
|
the issue is a matter of personal preferences.
|
|
671
681
|
|
|
682
|
+
For example, the µOS++ projects favour explicit comparator functions.
|
|
683
|
+
|
|
672
684
|
#### Explicit namespace
|
|
673
685
|
|
|
674
686
|
If for any reasons, the definitions in the `micro_test_plus` namespace
|
|
@@ -690,11 +702,11 @@ Example:
|
|
|
690
702
|
|
|
691
703
|
#### Exceptions
|
|
692
704
|
|
|
693
|
-
|
|
705
|
+
A C++ testing framework must be able to check if an expression
|
|
694
706
|
(usually a function call), throws or not an exception.
|
|
695
707
|
|
|
696
|
-
The following function templates allow to check
|
|
697
|
-
|
|
708
|
+
The following function templates allow to check various exceptions related
|
|
709
|
+
conditions:
|
|
698
710
|
|
|
699
711
|
```C++
|
|
700
712
|
// Check for any exception.
|
|
@@ -786,7 +798,7 @@ name, which is used for the default test suite:
|
|
|
786
798
|
void initialize (int argc, char* argv[], const char* name = "Main");
|
|
787
799
|
```
|
|
788
800
|
|
|
789
|
-
The arguments
|
|
801
|
+
The arguments can be used for controlling the verbosity level.
|
|
790
802
|
|
|
791
803
|
#### Return the test result
|
|
792
804
|
|
|
@@ -836,11 +848,13 @@ order (since the order in which the
|
|
|
836
848
|
static constructors are invoked is not specified);
|
|
837
849
|
thus there should be no dependencies between test suites.
|
|
838
850
|
|
|
839
|
-
|
|
851
|
+
The registered test suites are executed when the function
|
|
852
|
+
`exit_code()` is invoked.
|
|
840
853
|
|
|
841
854
|
Examples:
|
|
842
855
|
|
|
843
856
|
```c++
|
|
857
|
+
// Test suite with generic parameters.
|
|
844
858
|
static void
|
|
845
859
|
test_suite_args (int ic, int iv, int& ir, int* ip1, int* ip2)
|
|
846
860
|
{
|
|
@@ -915,35 +929,36 @@ TODO: add a test to show how to do this.
|
|
|
915
929
|
|
|
916
930
|
#### Verbosity
|
|
917
931
|
|
|
918
|
-
By default, the test reporter shows detailed results only for
|
|
919
|
-
|
|
932
|
+
By default, the test reporter shows detailed results only for the failed
|
|
933
|
+
test cases; successful test cases are shown as a single line with
|
|
920
934
|
the total counts of passed/failed checks.
|
|
921
935
|
|
|
922
|
-
To control the verbosity use one of the following command line options:
|
|
936
|
+
To control the verbosity, use one of the following command line options:
|
|
923
937
|
|
|
924
|
-
- `--verbose
|
|
925
|
-
- `--quiet
|
|
926
|
-
- `--silent
|
|
938
|
+
- `--verbose` - show all expectations, regardless of the result
|
|
939
|
+
- `--quiet` - show only the test suite totals
|
|
940
|
+
- `--silent` - suppress all output and only return the exit code
|
|
927
941
|
|
|
928
942
|
### Memory footprint
|
|
929
943
|
|
|
930
944
|
The memory footprint of unit tests based on µTest++ is definitely smaller than
|
|
931
|
-
that of traditional C++ testing framework,
|
|
932
|
-
used.
|
|
945
|
+
that of traditional C++ testing framework, mainly because the `iostream`
|
|
946
|
+
library is not used.
|
|
933
947
|
|
|
934
948
|
However, the use of templates for implementing the comparators and
|
|
935
949
|
operators should be carefully observed for platforms with really
|
|
936
950
|
limited amounts of memory, since each pair of different operands
|
|
937
951
|
contributes to the program size.
|
|
938
952
|
|
|
939
|
-
At the limit, µTest++ can be used
|
|
940
|
-
without custom comparators and operators
|
|
953
|
+
At the limit, µTest++ can be used
|
|
954
|
+
without custom comparators and operators
|
|
955
|
+
(only with regular boolean expressions), and still be able to provide
|
|
941
956
|
the basic functionality of testing various conditions, but without
|
|
942
957
|
the optional features of displaying the actual values compared.
|
|
943
958
|
|
|
944
|
-
Also, please note that the memory footprint on `debug
|
|
959
|
+
Also, please note that the memory footprint on `debug` (built with `-O0`),
|
|
945
960
|
is significantly larger than on `release`. If necessary, the optimization
|
|
946
|
-
for the `debug` build can be increased to `-Og`,
|
|
961
|
+
for the `debug` build can be increased to `-Og`, to save some memory.
|
|
947
962
|
|
|
948
963
|
### Build & integration info
|
|
949
964
|
|
|
@@ -952,19 +967,19 @@ written in C++ too, but the tested code can also be written in plain C.
|
|
|
952
967
|
The framework source code was compiled with GCC 11, clang 12
|
|
953
968
|
and arm-none-eabi-gcc 10, and should be warning free.
|
|
954
969
|
|
|
955
|
-
To run on embedded platforms
|
|
970
|
+
To run **on embedded platforms**, the test framework requires a minimum
|
|
956
971
|
of support from the system, like writing to the
|
|
957
972
|
output stream. Any such environments are acceptable, but for standalone
|
|
958
973
|
tests the most common solution is to use **Arm semihosting**.
|
|
959
974
|
|
|
960
975
|
To ease the integration of this package into user projects, there
|
|
961
|
-
are already made CMake and meson configuration files (see below).
|
|
976
|
+
are already made **CMake** and **meson** configuration files (see below).
|
|
962
977
|
|
|
963
978
|
For other build systems, consider the following details:
|
|
964
979
|
|
|
965
980
|
#### Include folders
|
|
966
981
|
|
|
967
|
-
The following folder should be
|
|
982
|
+
The following folder should be passed to the compiler during the build:
|
|
968
983
|
|
|
969
984
|
- `include`
|
|
970
985
|
|
|
@@ -976,7 +991,7 @@ The header file to be included is:
|
|
|
976
991
|
|
|
977
992
|
#### Source files
|
|
978
993
|
|
|
979
|
-
The source files to be added are:
|
|
994
|
+
The source files to be added to the build are:
|
|
980
995
|
|
|
981
996
|
- `src/micro-test-plus.cpp`
|
|
982
997
|
- `src/test-reporter.cpp`
|
|
@@ -1095,7 +1110,7 @@ main (int argc, char* argv[])
|
|
|
1095
1110
|
expect (compute_answer () != 43_i) << "answer != 43";
|
|
1096
1111
|
});
|
|
1097
1112
|
|
|
1098
|
-
test_case ("Check
|
|
1113
|
+
test_case ("Check parametrised", [] {
|
|
1099
1114
|
auto f = [] (int i) { return i + 42; };
|
|
1100
1115
|
expect (eq (f (1), 43)) << "lambda == 43";
|
|
1101
1116
|
});
|
|
@@ -1134,7 +1149,7 @@ $ xpm run test-native
|
|
|
1134
1149
|
1: Test timeout computed to be: 10000000
|
|
1135
1150
|
1: Built with clang Apple LLVM 13.0.0 (clang-1300.0.29.30), no FP, with exceptions.
|
|
1136
1151
|
1:
|
|
1137
|
-
1: Sample - test suite started
|
|
1152
|
+
1: • Sample - test suite started
|
|
1138
1153
|
1:
|
|
1139
1154
|
1: • Check various conditions - test case started
|
|
1140
1155
|
1: ✓ compute_one() == 1
|
|
@@ -1142,15 +1157,15 @@ $ xpm run test-native
|
|
|
1142
1157
|
1: ✓ condition() is true
|
|
1143
1158
|
1: ✓ Check various conditions - test case passed (3 checks)
|
|
1144
1159
|
1:
|
|
1145
|
-
1: • Check
|
|
1160
|
+
1: • Check parametrised - test case started
|
|
1146
1161
|
1: ✓ lambda == 43
|
|
1147
|
-
1: ✓ Check
|
|
1162
|
+
1: ✓ Check parametrised - test case passed (1 check)
|
|
1148
1163
|
1:
|
|
1149
1164
|
1: • Check exceptions - test case started
|
|
1150
1165
|
1: ✓ std::runtime_error thrown
|
|
1151
1166
|
1: ✓ Check exceptions - test case passed (1 check)
|
|
1152
1167
|
1:
|
|
1153
|
-
1: Sample - test suite passed (5 tests in 3 test cases)
|
|
1168
|
+
1: ✓ Sample - test suite passed (5 tests in 3 test cases)
|
|
1154
1169
|
1/2 Test #1: sample-test ...................... Passed 0.00 sec
|
|
1155
1170
|
...
|
|
1156
1171
|
```
|
|
@@ -1170,11 +1185,11 @@ The project is fully tested via GitHub
|
|
|
1170
1185
|
[Actions](https://github.com/micro-os-plus/micro-test-plus-xpack/actions/)
|
|
1171
1186
|
on each push.
|
|
1172
1187
|
|
|
1173
|
-
The test platforms are GNU/Linux
|
|
1174
|
-
compiled with GCC and clang; tests for embedded platforms are compiled
|
|
1175
|
-
with arm-none-eabi-gcc and run via QEMU
|
|
1188
|
+
The test platforms are **GNU/Linux**, **macOS** and **Windows**; native tests
|
|
1189
|
+
are compiled with GCC and clang; tests for embedded platforms are compiled
|
|
1190
|
+
with **arm-none-eabi-gcc** and run via **QEMU**.
|
|
1176
1191
|
|
|
1177
|
-
There are two
|
|
1192
|
+
There are two sets of tests, one that runs on every push, with a
|
|
1178
1193
|
limited number of tests, and a set that is triggered manually,
|
|
1179
1194
|
usually before releases, and runs all tests on all supported
|
|
1180
1195
|
platforms.
|
|
@@ -1198,12 +1213,12 @@ backwards incompatible changes are introduced to the public API.
|
|
|
1198
1213
|
The incompatible changes, in reverse chronological order,
|
|
1199
1214
|
are:
|
|
1200
1215
|
|
|
1201
|
-
- v3.x
|
|
1216
|
+
- **v3.x**: major rework, with full set of comparators, exceptions,
|
|
1202
1217
|
function templates for test cases and class templates for test suites;
|
|
1203
|
-
- v2.3.x
|
|
1218
|
+
- **v2.3.x**: deprecate `run_test_case(func, name)` in favour o
|
|
1204
1219
|
`run_test_case(name, func)`, to prepare for variadic templates
|
|
1205
|
-
- v2.x
|
|
1206
|
-
- v1.x
|
|
1220
|
+
- **v2.x**: the C++ namespace was renamed from `os` to `micro_os_plus`;
|
|
1221
|
+
- **v1.x**: the code was extracted from the mono-repo µOS++ project.
|
|
1207
1222
|
|
|
1208
1223
|
## Credits
|
|
1209
1224
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@micro-os-plus/micro-test-plus",
|
|
3
|
-
"version": "3.0.
|
|
4
|
-
"description": "A source library xPack with µTest++, a testing framework for embedded platforms",
|
|
3
|
+
"version": "3.0.2",
|
|
4
|
+
"description": "A source library xPack with µTest++, a lightweight testing framework for embedded platforms",
|
|
5
5
|
"main": "",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"npm-install": "npm install",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"@xpack-dev-tools/cmake": "3.21.6-1.1",
|
|
38
38
|
"@xpack-dev-tools/meson-build": "0.60.3-1.1",
|
|
39
39
|
"@xpack-dev-tools/ninja-build": "1.10.2-5.1",
|
|
40
|
-
"@micro-os-plus/build-helper": "2.
|
|
40
|
+
"@micro-os-plus/build-helper": "2.7.1",
|
|
41
41
|
"@micro-os-plus/diag-trace": "3.0.0"
|
|
42
42
|
},
|
|
43
43
|
"xpack": {
|