@micro-os-plus/micro-test-plus 3.0.0 → 3.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/README.md CHANGED
@@ -1,9 +1,9 @@
1
- [![license](https://img.shields.io/github/license/micro-os-plus/micro-test-plus-xpack)](https://github.com/micro-os-plus/micro-test-plus-xpack/blob/xpack/LICENSE)
1
+ [![license](https://img.shields.io/badge/license-MIT-blue)](https://github.com/micro-os-plus/micro-test-plus-xpack/blob/xpack/LICENSE)
2
2
  [![CI on Push](https://github.com/micro-os-plus/micro-test-plus-xpack/workflows/CI%20on%20Push/badge.svg)](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 relatively simple
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` folder.
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 https://github.com/micro-os-plus/micro-test-plus-xpack.git \
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 framework already includes several ready to use
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, and the
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++ projects
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, assumptions, exceptions
106
- - test cases, test suites
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, since there are no dependencies on
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, and automatically
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 (or simply tests),
122
- which are expected to be true;
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; the runner keeps counts of them;
128
- - assumptions are hard conditions expected to be true in order for the test
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 test (expectation or assumption)
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: a testable aspect of a component or system identified
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: a set of preconditions, inputs, actions (where applicable),
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: a set of test scripts or test procedures to be executed in
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, "answer is 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 that the function returns the wrong answer, the test will also fail;
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. There are similar
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, it is defined in a separate namespace (which must
308
- be explicitly refered, as shown) and matches only some specific types.
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 this specific type, a custom literal
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 operator to match, it is necessary for at least one of the operands
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 or use custom comparators/operators derived from a
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 may use any expression evaluating to a
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 since
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 () }, "fortytwo"sv))
447
- << "ultimate_answer is 'fortytwo'";
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 () } == "fortytwo"sv)
543
- << "ultimate answer == 'fortytwo'";
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 }";
@@ -550,7 +560,7 @@ test_case ("Operators", [] {
550
560
  });
551
561
  ```
552
562
 
553
- ### Logical operators
563
+ #### Logical operators
554
564
 
555
565
  Similarly, logical operators are defined:
556
566
 
@@ -654,8 +664,8 @@ expect (_f {expression} == 42_f);
654
664
 
655
665
  #### Function comparators vs. operators & literals
656
666
 
657
- A very good question is which to use, functions like `eq()` or the
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 understood the differences,
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
- Specific to C++, a testing framework must be able check if an expression
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 for any exception,
697
- for a specific exception, or for no exception at all:
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 are used for controlling the verbosity level.
801
+ The arguments can be used for controlling the verbosity level.
790
802
 
791
803
  #### Return the test result
792
804
 
@@ -813,45 +825,59 @@ For complex applications there can be multiple test
813
825
  suites, usually in separate source files.
814
826
 
815
827
  In order to make self-registration possible, test suites are classes,
816
- constructed with a name and a callable (usually a lambda),
817
- which chains the execution of the test cases:
828
+ constructed with a name, a callable (usually a lambda
829
+ which chains the execution of the test cases) and optional
830
+ arguments:
818
831
 
819
832
  ```C++
833
+ class test_suite : public test_suite_base
834
+ {
835
+ public:
820
836
  template <typename Callable_T, typename... Args_T>
821
- class test_suite : public test_suite_base
822
- {
823
- public:
824
- test_suite (const char* name, Callable_T&& callable,
825
- Args_T&&... arguments);
826
- // ...
827
- }
837
+ test_suite (const char* name, Callable_T&& callable,
838
+ Args_T&&... arguments);
839
+ // ...
840
+ }
828
841
  ```
829
842
 
830
843
  It is recommended to instantiate the test suites as static objects.
844
+
831
845
  The self-registration is done in the constructor.
832
846
  Test suites defined in different compilation units can be executed in any
833
847
  order (since the order in which the
834
848
  static constructors are invoked is not specified);
835
849
  thus there should be no dependencies between test suites.
836
850
 
837
- Test suites are executed when the function `exit_code()` is invoked.
851
+ The registered test suites are executed when the function
852
+ `exit_code()` is invoked.
838
853
 
839
854
  Examples:
840
855
 
841
856
  ```c++
842
- using namespace micro_os_plus::micro_test_plus;
857
+ // Test suite with generic parameters.
858
+ static void
859
+ test_suite_args (int ic, int iv, int& ir, int* ip1, int* ip2)
860
+ {
861
+ using namespace micro_os_plus::micro_test_plus;
843
862
 
844
- static test_suite ts_1
845
- = { "Separate", [] {
863
+ test_case ("args", [&] {
864
+ expect (eq (ic, 42)) << "ic is 42";
865
+ expect (eq (iv, 43)) << "iv is 43";
866
+ expect (eq (ir, 44)) << "ir is 44";
867
+ expect (eq (*ip1, 45)) << "*ip1 is 45";
868
+ expect (eq (*ip2, 46)) << "*ip2 is 46";
869
+ });
870
+ }
846
871
 
847
- test_case ("Check one", [] {
848
- expect (true) << "Passed";
849
- });
872
+ static int in = 43;
873
+ static int in44 = 44;
874
+ static int& ir = in44;
875
+ static int in45 = 45;
876
+ static int in46 = 46;
877
+ static int* ip2 = &in46;
850
878
 
851
- test_case ("Check two", [] {
852
- expect (true) << "Passed";
853
- });
854
- }};
879
+ static micro_os_plus::micro_test_plus::test_suite ts_args
880
+ = { "Args", test_suite_args, 42, in, ir, &in45, ip2 };
855
881
  ```
856
882
 
857
883
  #### Utility functions
@@ -903,35 +929,36 @@ TODO: add a test to show how to do this.
903
929
 
904
930
  #### Verbosity
905
931
 
906
- By default, the test reporter shows detailed results only for test cases
907
- that failed; successful test cases are shown as a single line with
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
908
934
  the total counts of passed/failed checks.
909
935
 
910
- 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:
911
937
 
912
- - `--verbose`: show all expectations, regardless of the result
913
- - `--quiet`: show only the test suite totals
914
- - `--silent`: suppress all output and only return the exit code
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
915
941
 
916
942
  ### Memory footprint
917
943
 
918
944
  The memory footprint of unit tests based on µTest++ is definitely smaller than
919
- that of traditional C++ testing framework, since the `iostream` library is not
920
- used.
945
+ that of traditional C++ testing framework, mainly because the `iostream`
946
+ library is not used.
921
947
 
922
948
  However, the use of templates for implementing the comparators and
923
949
  operators should be carefully observed for platforms with really
924
950
  limited amounts of memory, since each pair of different operands
925
951
  contributes to the program size.
926
952
 
927
- At the limit, µTest++ can be used only with regular boolean expressions,
928
- without custom comparators and operators, and still be able to provide
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
929
956
  the basic functionality of testing various conditions, but without
930
957
  the optional features of displaying the actual values compared.
931
958
 
932
- Also, please note that the memory footprint on `debug`, built with `-O0`,
959
+ Also, please note that the memory footprint on `debug` (built with `-O0`),
933
960
  is significantly larger than on `release`. If necessary, the optimization
934
- for the `debug` build can be increased to `-Og`, and save some memory.
961
+ for the `debug` build can be increased to `-Og`, to save some memory.
935
962
 
936
963
  ### Build & integration info
937
964
 
@@ -940,31 +967,31 @@ written in C++ too, but the tested code can also be written in plain C.
940
967
  The framework source code was compiled with GCC 11, clang 12
941
968
  and arm-none-eabi-gcc 10, and should be warning free.
942
969
 
943
- To run on embedded platforms, the test framework requires a minimum
970
+ To run **on embedded platforms**, the test framework requires a minimum
944
971
  of support from the system, like writing to the
945
972
  output stream. Any such environments are acceptable, but for standalone
946
973
  tests the most common solution is to use **Arm semihosting**.
947
974
 
948
975
  To ease the integration of this package into user projects, there
949
- are already made CMake and meson configuration files (see below).
976
+ are already made **CMake** and **meson** configuration files (see below).
950
977
 
951
978
  For other build systems, consider the following details:
952
979
 
953
980
  #### Include folders
954
981
 
955
- The following folder should be used during the build:
982
+ The following folders should be passed to the compiler during the build:
956
983
 
957
984
  - `include`
958
985
 
959
- The header file to be included is:
986
+ The header files to be included in user projects are:
960
987
 
961
988
  ```c++
962
989
  #include <micro-os-plus/micro-test-plus.h>
963
990
  ```
964
991
 
965
- #### Source folders
992
+ #### Source files
966
993
 
967
- The source files to be added are:
994
+ The source files to be added to the build are:
968
995
 
969
996
  - `src/micro-test-plus.cpp`
970
997
  - `src/test-reporter.cpp`
@@ -973,8 +1000,9 @@ The source files to be added are:
973
1000
 
974
1001
  #### Preprocessor definitions
975
1002
 
976
- - `MICRO_OS_PLUS_TRACE` - to include the trace
977
- - `MICRO_TEST_PLUS_TRACE` to enable some tracing messages
1003
+ - `MICRO_OS_PLUS_INCLUDE_CONFIG_H` - to include `<micro-os-plus/config.h>`
1004
+ - `MICRO_OS_PLUS_TRACE` - to include the trace calls
1005
+ - `MICRO_TEST_PLUS_TRACE` - to enable some tracing messages
978
1006
 
979
1007
  #### Compiler options
980
1008
 
@@ -1082,7 +1110,7 @@ main (int argc, char* argv[])
1082
1110
  expect (compute_answer () != 43_i) << "answer != 43";
1083
1111
  });
1084
1112
 
1085
- test_case ("Check parameterised", [] {
1113
+ test_case ("Check parametrised", [] {
1086
1114
  auto f = [] (int i) { return i + 42; };
1087
1115
  expect (eq (f (1), 43)) << "lambda == 43";
1088
1116
  });
@@ -1121,7 +1149,7 @@ $ xpm run test-native
1121
1149
  1: Test timeout computed to be: 10000000
1122
1150
  1: Built with clang Apple LLVM 13.0.0 (clang-1300.0.29.30), no FP, with exceptions.
1123
1151
  1:
1124
- 1: Sample - test suite started
1152
+ 1: Sample - test suite started
1125
1153
  1:
1126
1154
  1: • Check various conditions - test case started
1127
1155
  1: ✓ compute_one() == 1
@@ -1129,15 +1157,15 @@ $ xpm run test-native
1129
1157
  1: ✓ condition() is true
1130
1158
  1: ✓ Check various conditions - test case passed (3 checks)
1131
1159
  1:
1132
- 1: • Check parameterised - test case started
1160
+ 1: • Check parametrised - test case started
1133
1161
  1: ✓ lambda == 43
1134
- 1: ✓ Check parameterised - test case passed (1 check)
1162
+ 1: ✓ Check parametrised - test case passed (1 check)
1135
1163
  1:
1136
1164
  1: • Check exceptions - test case started
1137
1165
  1: ✓ std::runtime_error thrown
1138
1166
  1: ✓ Check exceptions - test case passed (1 check)
1139
1167
  1:
1140
- 1: Sample - test suite passed (5 tests in 3 test cases)
1168
+ 1: Sample - test suite passed (5 tests in 3 test cases)
1141
1169
  1/2 Test #1: sample-test ...................... Passed 0.00 sec
1142
1170
  ...
1143
1171
  ```
@@ -1157,11 +1185,11 @@ The project is fully tested via GitHub
1157
1185
  [Actions](https://github.com/micro-os-plus/micro-test-plus-xpack/actions/)
1158
1186
  on each push.
1159
1187
 
1160
- The test platforms are GNU/Linux, macOS and Windows; native tests are
1161
- compiled with GCC and clang; tests for embedded platforms are compiled
1162
- 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**.
1163
1191
 
1164
- There are two set of tests, one that runs on every push, with a
1192
+ There are two sets of tests, one that runs on every push, with a
1165
1193
  limited number of tests, and a set that is triggered manually,
1166
1194
  usually before releases, and runs all tests on all supported
1167
1195
  platforms.
@@ -1185,12 +1213,12 @@ backwards incompatible changes are introduced to the public API.
1185
1213
  The incompatible changes, in reverse chronological order,
1186
1214
  are:
1187
1215
 
1188
- - v3.x: major rework, with full set of comparators, exceptions,
1216
+ - **v3.x**: major rework, with full set of comparators, exceptions,
1189
1217
  function templates for test cases and class templates for test suites;
1190
- - v2.3.x: deprecate `run_test_case(func, name)` in favour o
1218
+ - **v2.3.x**: deprecate `run_test_case(func, name)` in favour o
1191
1219
  `run_test_case(name, func)`, to prepare for variadic templates
1192
- - v2.x: the C++ namespace was renamed from `os` to `micro_os_plus`;
1193
- - v1.x: the code was extracted from the mono-repo µOS++ project.
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.
1194
1222
 
1195
1223
  ## Credits
1196
1224
 
@@ -38,12 +38,10 @@ namespace micro_os_plus::micro_test_plus
38
38
  // --------------------------------------------------------------------------
39
39
 
40
40
  template <typename Callable_T, typename... Args_T>
41
- test_suite<Callable_T, Args_T...>::test_suite (const char* name,
42
- Callable_T&& callable,
43
- Args_T&&... arguments)
44
- : test_suite_base{ name }, callable_{ std::forward<Callable_T> (
45
- callable) },
46
- arguments_{ std::forward<Args_T> (arguments)... }
41
+ test_suite::test_suite (const char* name, Callable_T&& callable,
42
+ Args_T&&... arguments)
43
+ : test_suite_base{ name }, callable_{ std::bind (callable,
44
+ arguments...) }
47
45
  {
48
46
  #if defined(MICRO_TEST_PLUS_TRACE)
49
47
  printf ("%s\n", __PRETTY_FUNCTION__);
@@ -52,25 +50,6 @@ namespace micro_os_plus::micro_test_plus
52
50
  runner.register_test_suite (this);
53
51
  }
54
52
 
55
- template <typename Callable_T, typename... Args_T>
56
- test_suite<Callable_T, Args_T...>::~test_suite ()
57
- {
58
- #if defined(MICRO_TEST_PLUS_TRACE)
59
- printf ("%s\n", __PRETTY_FUNCTION__);
60
- #endif // MICRO_TEST_PLUS_TRACE
61
- }
62
-
63
- template <typename Callable_T, typename... Args_T>
64
- void
65
- test_suite<Callable_T, Args_T...>::run (void)
66
- {
67
- current_test_suite = this;
68
-
69
- begin_test_suite ();
70
- std::apply (callable_, arguments_);
71
- end_test_suite ();
72
- }
73
-
74
53
  // --------------------------------------------------------------------------
75
54
 
76
55
  template <typename Callable_T, typename... Args_T>
@@ -40,6 +40,7 @@
40
40
 
41
41
  #if defined(__GNUC__)
42
42
  #pragma GCC diagnostic push
43
+
43
44
  #pragma GCC diagnostic ignored "-Wpadded"
44
45
  #pragma GCC diagnostic ignored "-Waggregate-return"
45
46
  #if defined(__clang__)
@@ -520,6 +521,10 @@ namespace micro_os_plus::micro_test_plus
520
521
  #pragma GCC diagnostic pop
521
522
  #endif
522
523
 
524
+ // ----------------------------------------------------------------------------
525
+
526
+ #endif // __cplusplus
527
+
523
528
  // ===== Inline & template implementations ====================================
524
529
 
525
530
  #include "test-reporter-inlines.h"
@@ -529,10 +534,6 @@ namespace micro_os_plus::micro_test_plus
529
534
 
530
535
  // ----------------------------------------------------------------------------
531
536
 
532
- #endif // __cplusplus
533
-
534
- // ----------------------------------------------------------------------------
535
-
536
537
  #endif // MICRO_TEST_PLUS_MICRO_TEST_PLUS_H_
537
538
 
538
539
  // ----------------------------------------------------------------------------