@micro-os-plus/micro-test-plus 3.1.2 → 3.2.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 +195 -10
- package/CMakeLists.txt +3 -4
- package/LICENSE +1 -1
- package/README.md +15 -14
- package/include/micro-os-plus/detail.h +19 -5
- package/include/micro-os-plus/inlines.h +25 -16
- package/include/micro-os-plus/literals.h +113 -15
- package/include/micro-os-plus/math.h +4 -5
- package/include/micro-os-plus/micro-test-plus.h +10 -8
- package/include/micro-os-plus/reflection.h +9 -8
- package/include/micro-os-plus/test-reporter-inlines.h +4 -5
- package/include/micro-os-plus/test-reporter.h +7 -5
- package/include/micro-os-plus/test-runner.h +5 -5
- package/include/micro-os-plus/test-suite.h +6 -5
- package/include/micro-os-plus/type-traits.h +36 -5
- package/meson.build +3 -4
- package/package.json +32 -19
- package/src/micro-test-plus.cpp +19 -12
- package/src/test-reporter.cpp +4 -5
- package/src/test-runner.cpp +10 -11
- package/src/test-suite.cpp +10 -11
- package/xcdl.json +32 -0
- package/LICENSE-Boost +0 -23
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* This file is part of the µOS++
|
|
3
|
-
*
|
|
4
|
-
* Copyright (c) 2021 Liviu Ionescu.
|
|
2
|
+
* This file is part of the µOS++ project (https://micro-os-plus.github.io/).
|
|
3
|
+
* Copyright (c) 2021 Liviu Ionescu. All rights reserved.
|
|
5
4
|
*
|
|
6
5
|
* Permission to use, copy, modify, and/or distribute this software
|
|
7
6
|
* for any purpose is hereby granted, under the terms of the MIT license.
|
|
8
7
|
*
|
|
9
8
|
* If a copy of the license was not distributed with this file, it can
|
|
10
|
-
* be obtained from
|
|
9
|
+
* be obtained from https://opensource.org/licenses/mit.
|
|
11
10
|
*
|
|
12
11
|
* Major parts of the code are inspired from v1.1.8 of the Boost UT project,
|
|
13
12
|
* released under the terms of the Boost Version 1.0 Software License,
|
|
14
|
-
* which can be obtained from
|
|
13
|
+
* which can be obtained from https://www.boost.org/LICENSE_1_0.txt.
|
|
15
14
|
*/
|
|
16
15
|
|
|
17
16
|
#ifndef MICRO_TEST_PLUS_LITERALS_H_
|
|
@@ -347,39 +346,132 @@ namespace micro_os_plus::micro_test_plus
|
|
|
347
346
|
|
|
348
347
|
// --------------------------------------------------------------------------
|
|
349
348
|
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
349
|
+
#if defined(__GNUC__)
|
|
350
|
+
#pragma GCC diagnostic push
|
|
351
|
+
#if defined(__clang__)
|
|
352
|
+
#pragma clang diagnostic ignored "-Wdocumentation-deprecated-sync"
|
|
353
|
+
#endif
|
|
354
|
+
#endif
|
|
354
355
|
|
|
355
|
-
|
|
356
|
-
// that are recognised by the comparators.
|
|
357
|
-
// The syntax is similar to function calls, like `_i(expression)`, but the
|
|
358
|
-
// results have custom types expected by comparators.
|
|
356
|
+
/** @deprecated Use `to_b` (since 3.2.0). */
|
|
359
357
|
using _b = type_traits::value<bool>;
|
|
358
|
+
/** @deprecated Use `to_c` (since 3.2.0). */
|
|
360
359
|
using _c = type_traits::value<char>;
|
|
360
|
+
/** @deprecated Use `to_sc` (since 3.2.0). */
|
|
361
361
|
using _sc = type_traits::value<signed char>;
|
|
362
|
+
/** @deprecated Use `to_s` (since 3.2.0). */
|
|
362
363
|
using _s = type_traits::value<short>;
|
|
364
|
+
/** @deprecated Use `to_i` (since 3.2.0). */
|
|
363
365
|
using _i = type_traits::value<int>;
|
|
366
|
+
/** @deprecated Use `to_l` (since 3.2.0). */
|
|
364
367
|
using _l = type_traits::value<long>;
|
|
368
|
+
/** @deprecated Use `to_ll` (since 3.2.0). */
|
|
365
369
|
using _ll = type_traits::value<long long>;
|
|
370
|
+
/** @deprecated Use `to_u` (since 3.2.0). */
|
|
366
371
|
using _u = type_traits::value<unsigned>;
|
|
372
|
+
/** @deprecated Use `to_uc` (since 3.2.0). */
|
|
367
373
|
using _uc = type_traits::value<unsigned char>;
|
|
374
|
+
/** @deprecated Use `to_us` (since 3.2.0). */
|
|
368
375
|
using _us = type_traits::value<unsigned short>;
|
|
376
|
+
/** @deprecated Use `to_ul` (since 3.2.0). */
|
|
369
377
|
using _ul = type_traits::value<unsigned long>;
|
|
378
|
+
/** @deprecated Use `to_ull` (since 3.2.0). */
|
|
370
379
|
using _ull = type_traits::value<unsigned long long>;
|
|
380
|
+
/** @deprecated Use `to_i8` (since 3.2.0). */
|
|
371
381
|
using _i8 = type_traits::value<std::int8_t>;
|
|
382
|
+
/** @deprecated Use `to_i16` (since 3.2.0). */
|
|
372
383
|
using _i16 = type_traits::value<std::int16_t>;
|
|
384
|
+
/** @deprecated Use `to_i32` (since 3.2.0). */
|
|
373
385
|
using _i32 = type_traits::value<std::int32_t>;
|
|
386
|
+
/** @deprecated Use `to_i64` (since 3.2.0). */
|
|
374
387
|
using _i64 = type_traits::value<std::int64_t>;
|
|
388
|
+
/** @deprecated Use `to_u8` (since 3.2.0). */
|
|
375
389
|
using _u8 = type_traits::value<std::uint8_t>;
|
|
390
|
+
/** @deprecated Use `to_u16` (since 3.2.0). */
|
|
376
391
|
using _u16 = type_traits::value<std::uint16_t>;
|
|
392
|
+
/** @deprecated Use `to_u32` (since 3.2.0). */
|
|
377
393
|
using _u32 = type_traits::value<std::uint32_t>;
|
|
394
|
+
/** @deprecated Use `to_u64` (since 3.2.0). */
|
|
378
395
|
using _u64 = type_traits::value<std::uint64_t>;
|
|
396
|
+
/** @deprecated Use `to_f` (since 3.2.0). */
|
|
379
397
|
using _f = type_traits::value<float>;
|
|
398
|
+
/** @deprecated Use `to_d` (since 3.2.0). */
|
|
380
399
|
using _d = type_traits::value<double>;
|
|
400
|
+
/** @deprecated Use `to_ld` (since 3.2.0). */
|
|
381
401
|
using _ld = type_traits::value<long double>;
|
|
382
402
|
|
|
403
|
+
/**
|
|
404
|
+
* @deprecated Use `to_t` (since 3.2.0).
|
|
405
|
+
* @headerfile micro-test-plus.h <micro-os-plus/micro-test-plus.h>
|
|
406
|
+
*/
|
|
407
|
+
template <class T>
|
|
408
|
+
struct _t : type_traits::value<T>
|
|
409
|
+
{
|
|
410
|
+
constexpr explicit _t (const T& t) : type_traits::value<T>{ t }
|
|
411
|
+
{
|
|
412
|
+
}
|
|
413
|
+
};
|
|
414
|
+
|
|
415
|
+
#if defined(__GNUC__)
|
|
416
|
+
#pragma GCC diagnostic pop
|
|
417
|
+
#endif
|
|
418
|
+
|
|
419
|
+
/**
|
|
420
|
+
* @addtogroup micro-test-plus-literals
|
|
421
|
+
* @{
|
|
422
|
+
*/
|
|
423
|
+
|
|
424
|
+
// Wrappers that can be used to convert dynamic values to specific types
|
|
425
|
+
// that are recognised by the comparators.
|
|
426
|
+
// The syntax is similar to function calls, like `_i(expression)`, but the
|
|
427
|
+
// results have custom types expected by comparators.
|
|
428
|
+
/** @since 3.2.0 */
|
|
429
|
+
using to_b = type_traits::value<bool>;
|
|
430
|
+
/** @since 3.2.0 */
|
|
431
|
+
using to_c = type_traits::value<char>;
|
|
432
|
+
/** @since 3.2.0 */
|
|
433
|
+
using to_sc = type_traits::value<signed char>;
|
|
434
|
+
/** @since 3.2.0 */
|
|
435
|
+
using to_s = type_traits::value<short>;
|
|
436
|
+
/** @since 3.2.0 */
|
|
437
|
+
using to_i = type_traits::value<int>;
|
|
438
|
+
/** @since 3.2.0 */
|
|
439
|
+
using to_l = type_traits::value<long>;
|
|
440
|
+
/** @since 3.2.0 */
|
|
441
|
+
using to_ll = type_traits::value<long long>;
|
|
442
|
+
/** @since 3.2.0 */
|
|
443
|
+
using to_u = type_traits::value<unsigned>;
|
|
444
|
+
/** @since 3.2.0 */
|
|
445
|
+
using to_uc = type_traits::value<unsigned char>;
|
|
446
|
+
/** @since 3.2.0 */
|
|
447
|
+
using to_us = type_traits::value<unsigned short>;
|
|
448
|
+
/** @since 3.2.0 */
|
|
449
|
+
using to_ul = type_traits::value<unsigned long>;
|
|
450
|
+
/** @since 3.2.0 */
|
|
451
|
+
using to_ull = type_traits::value<unsigned long long>;
|
|
452
|
+
/** @since 3.2.0 */
|
|
453
|
+
using to_i8 = type_traits::value<std::int8_t>;
|
|
454
|
+
/** @since 3.2.0 */
|
|
455
|
+
using to_i16 = type_traits::value<std::int16_t>;
|
|
456
|
+
/** @since 3.2.0 */
|
|
457
|
+
using to_i32 = type_traits::value<std::int32_t>;
|
|
458
|
+
/** @since 3.2.0 */
|
|
459
|
+
using to_i64 = type_traits::value<std::int64_t>;
|
|
460
|
+
/** @since 3.2.0 */
|
|
461
|
+
using to_u8 = type_traits::value<std::uint8_t>;
|
|
462
|
+
/** @since 3.2.0 */
|
|
463
|
+
using to_u16 = type_traits::value<std::uint16_t>;
|
|
464
|
+
/** @since 3.2.0 */
|
|
465
|
+
using to_u32 = type_traits::value<std::uint32_t>;
|
|
466
|
+
/** @since 3.2.0 */
|
|
467
|
+
using to_u64 = type_traits::value<std::uint64_t>;
|
|
468
|
+
/** @since 3.2.0 */
|
|
469
|
+
using to_f = type_traits::value<float>;
|
|
470
|
+
/** @since 3.2.0 */
|
|
471
|
+
using to_d = type_traits::value<double>;
|
|
472
|
+
/** @since 3.2.0 */
|
|
473
|
+
using to_ld = type_traits::value<long double>;
|
|
474
|
+
|
|
383
475
|
/**
|
|
384
476
|
* @}
|
|
385
477
|
*/
|
|
@@ -387,11 +479,17 @@ namespace micro_os_plus::micro_test_plus
|
|
|
387
479
|
/**
|
|
388
480
|
* @ingroup micro-test-plus-literals
|
|
389
481
|
* @brief Template for wrapping any other type.
|
|
482
|
+
* @headerfile micro-test-plus.h <micro-os-plus/micro-test-plus.h>
|
|
483
|
+
* @since 3.2.0
|
|
484
|
+
*
|
|
485
|
+
* @details
|
|
486
|
+
* A public class used only to convert the type.
|
|
390
487
|
*/
|
|
391
488
|
template <class T>
|
|
392
|
-
struct
|
|
489
|
+
struct to_t : type_traits::value<T>
|
|
393
490
|
{
|
|
394
|
-
|
|
491
|
+
/** @brief Constructor. */
|
|
492
|
+
constexpr explicit to_t (const T& t) : type_traits::value<T>{ t }
|
|
395
493
|
{
|
|
396
494
|
}
|
|
397
495
|
};
|
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* This file is part of the µOS++
|
|
3
|
-
*
|
|
4
|
-
* Copyright (c) 2021 Liviu Ionescu.
|
|
2
|
+
* This file is part of the µOS++ project (https://micro-os-plus.github.io/).
|
|
3
|
+
* Copyright (c) 2021 Liviu Ionescu. All rights reserved.
|
|
5
4
|
*
|
|
6
5
|
* Permission to use, copy, modify, and/or distribute this software
|
|
7
6
|
* for any purpose is hereby granted, under the terms of the MIT license.
|
|
8
7
|
*
|
|
9
8
|
* If a copy of the license was not distributed with this file, it can
|
|
10
|
-
* be obtained from
|
|
9
|
+
* be obtained from https://opensource.org/licenses/mit.
|
|
11
10
|
*
|
|
12
11
|
* Major parts of the code are inspired from v1.1.8 of the Boost UT project,
|
|
13
12
|
* released under the terms of the Boost Version 1.0 Software License,
|
|
14
|
-
* which can be obtained from
|
|
13
|
+
* which can be obtained from https://www.boost.org/LICENSE_1_0.txt.
|
|
15
14
|
*/
|
|
16
15
|
|
|
17
16
|
#ifndef MICRO_TEST_PLUS_MATH_H_
|
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* This file is part of the µOS++
|
|
3
|
-
*
|
|
4
|
-
* Copyright (c) 2021 Liviu Ionescu.
|
|
2
|
+
* This file is part of the µOS++ project (https://micro-os-plus.github.io/).
|
|
3
|
+
* Copyright (c) 2021 Liviu Ionescu. All rights reserved.
|
|
5
4
|
*
|
|
6
5
|
* Permission to use, copy, modify, and/or distribute this software
|
|
7
6
|
* for any purpose is hereby granted, under the terms of the MIT license.
|
|
8
7
|
*
|
|
9
8
|
* If a copy of the license was not distributed with this file, it can
|
|
10
|
-
* be obtained from
|
|
9
|
+
* be obtained from https://opensource.org/licenses/mit.
|
|
11
10
|
*
|
|
12
11
|
* Major parts of the code are inspired from v1.1.8 of the Boost UT project,
|
|
13
12
|
* released under the terms of the Boost Version 1.0 Software License,
|
|
14
|
-
* which can be obtained from
|
|
13
|
+
* which can be obtained from https://www.boost.org/LICENSE_1_0.txt.
|
|
15
14
|
*/
|
|
16
15
|
|
|
17
16
|
#ifndef MICRO_TEST_PLUS_MICRO_TEST_PLUS_H_
|
|
@@ -40,7 +39,6 @@
|
|
|
40
39
|
|
|
41
40
|
#if defined(__GNUC__)
|
|
42
41
|
#pragma GCC diagnostic push
|
|
43
|
-
|
|
44
42
|
#pragma GCC diagnostic ignored "-Wpadded"
|
|
45
43
|
#pragma GCC diagnostic ignored "-Waggregate-return"
|
|
46
44
|
#if defined(__clang__)
|
|
@@ -128,7 +126,9 @@ namespace micro_os_plus::micro_test_plus
|
|
|
128
126
|
*
|
|
129
127
|
* @par Example
|
|
130
128
|
* ```cpp
|
|
131
|
-
*
|
|
129
|
+
* namespace mt = micro_os_plus::micro_test_plus;
|
|
130
|
+
*
|
|
131
|
+
* mt::expect (compute_answer () == 42) << "answer is 42";
|
|
132
132
|
* ```
|
|
133
133
|
*/
|
|
134
134
|
template <class Expr_T, type_traits::requires_t<
|
|
@@ -156,7 +156,9 @@ namespace micro_os_plus::micro_test_plus
|
|
|
156
156
|
*
|
|
157
157
|
* @par Example
|
|
158
158
|
* ```cpp
|
|
159
|
-
*
|
|
159
|
+
* namespace mt = micro_os_plus::micro_test_plus;
|
|
160
|
+
*
|
|
161
|
+
* mt::assume (compute_answer () == 42) << "answer is 42";
|
|
160
162
|
* ```
|
|
161
163
|
*/
|
|
162
164
|
template <class Expr_T, type_traits::requires_t<
|
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* This file is part of the µOS++
|
|
3
|
-
*
|
|
4
|
-
* Copyright (c) 2021 Liviu Ionescu.
|
|
2
|
+
* This file is part of the µOS++ project (https://micro-os-plus.github.io/).
|
|
3
|
+
* Copyright (c) 2021 Liviu Ionescu. All rights reserved.
|
|
5
4
|
*
|
|
6
5
|
* Permission to use, copy, modify, and/or distribute this software
|
|
7
6
|
* for any purpose is hereby granted, under the terms of the MIT license.
|
|
8
7
|
*
|
|
9
8
|
* If a copy of the license was not distributed with this file, it can
|
|
10
|
-
* be obtained from
|
|
9
|
+
* be obtained from https://opensource.org/licenses/mit.
|
|
11
10
|
*
|
|
12
11
|
* Major parts of the code are inspired from v1.1.8 of the Boost UT project,
|
|
13
12
|
* released under the terms of the Boost Version 1.0 Software License,
|
|
14
|
-
* which can be obtained from
|
|
13
|
+
* which can be obtained from https://www.boost.org/LICENSE_1_0.txt.
|
|
15
14
|
*/
|
|
16
15
|
|
|
17
16
|
#ifndef MICRO_TEST_PLUS_REFLECTION_H_
|
|
@@ -52,6 +51,7 @@ namespace micro_os_plus::micro_test_plus
|
|
|
52
51
|
#else
|
|
53
52
|
/**
|
|
54
53
|
* @brief Local implementation of the std::source_location.
|
|
54
|
+
* @headerfile micro-test-plus.h <micro-os-plus/micro-test-plus.h>
|
|
55
55
|
*/
|
|
56
56
|
class source_location
|
|
57
57
|
{
|
|
@@ -59,9 +59,10 @@ namespace micro_os_plus::micro_test_plus
|
|
|
59
59
|
[[nodiscard]] static constexpr auto
|
|
60
60
|
current (
|
|
61
61
|
#if (__has_builtin(__builtin_FILE) and __has_builtin(__builtin_LINE))
|
|
62
|
-
const char* file = __builtin_FILE (),
|
|
62
|
+
const char* file = __builtin_FILE (),
|
|
63
|
+
unsigned int line = __builtin_LINE ()
|
|
63
64
|
#else
|
|
64
|
-
const char* file = "unknown", int line = {}
|
|
65
|
+
const char* file = "unknown", unsigned int line = {}
|
|
65
66
|
#endif
|
|
66
67
|
) noexcept
|
|
67
68
|
{
|
|
@@ -85,7 +86,7 @@ namespace micro_os_plus::micro_test_plus
|
|
|
85
86
|
|
|
86
87
|
private:
|
|
87
88
|
const char* file_{ "unknown" };
|
|
88
|
-
int line_{};
|
|
89
|
+
unsigned int line_{};
|
|
89
90
|
};
|
|
90
91
|
|
|
91
92
|
#endif
|
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* This file is part of the µOS++
|
|
3
|
-
*
|
|
4
|
-
* Copyright (c) 2021 Liviu Ionescu.
|
|
2
|
+
* This file is part of the µOS++ project (https://micro-os-plus.github.io/).
|
|
3
|
+
* Copyright (c) 2021 Liviu Ionescu. All rights reserved.
|
|
5
4
|
*
|
|
6
5
|
* Permission to use, copy, modify, and/or distribute this software
|
|
7
6
|
* for any purpose is hereby granted, under the terms of the MIT license.
|
|
8
7
|
*
|
|
9
8
|
* If a copy of the license was not distributed with this file, it can
|
|
10
|
-
* be obtained from
|
|
9
|
+
* be obtained from https://opensource.org/licenses/mit.
|
|
11
10
|
*
|
|
12
11
|
* Major parts of the code are inspired from v1.1.8 of the Boost UT project,
|
|
13
12
|
* released under the terms of the Boost Version 1.0 Software License,
|
|
14
|
-
* which can be obtained from
|
|
13
|
+
* which can be obtained from https://www.boost.org/LICENSE_1_0.txt.
|
|
15
14
|
*/
|
|
16
15
|
|
|
17
16
|
#ifndef MICRO_TEST_PLUS_TEST_REPORTER_INLINES_H_
|
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* This file is part of the µOS++
|
|
3
|
-
*
|
|
4
|
-
* Copyright (c) 2021 Liviu Ionescu.
|
|
2
|
+
* This file is part of the µOS++ project (https://micro-os-plus.github.io/).
|
|
3
|
+
* Copyright (c) 2021 Liviu Ionescu. All rights reserved.
|
|
5
4
|
*
|
|
6
5
|
* Permission to use, copy, modify, and/or distribute this software
|
|
7
6
|
* for any purpose is hereby granted, under the terms of the MIT license.
|
|
8
7
|
*
|
|
9
8
|
* If a copy of the license was not distributed with this file, it can
|
|
10
|
-
* be obtained from
|
|
9
|
+
* be obtained from https://opensource.org/licenses/mit.
|
|
11
10
|
*
|
|
12
11
|
* Major parts of the code are inspired from v1.1.8 of the Boost UT project,
|
|
13
12
|
* released under the terms of the Boost Version 1.0 Software License,
|
|
14
|
-
* which can be obtained from
|
|
13
|
+
* which can be obtained from https://www.boost.org/LICENSE_1_0.txt.
|
|
15
14
|
*/
|
|
16
15
|
|
|
17
16
|
#ifndef MICRO_TEST_PLUS_TEST_REPORTER_H_
|
|
@@ -49,6 +48,7 @@ namespace micro_os_plus::micro_test_plus
|
|
|
49
48
|
|
|
50
49
|
/**
|
|
51
50
|
* @brief Colours used to highlight pass vs. fail.
|
|
51
|
+
* @headerfile micro-test-plus.h <micro-os-plus/micro-test-plus.h>
|
|
52
52
|
*/
|
|
53
53
|
struct colors
|
|
54
54
|
{
|
|
@@ -59,6 +59,7 @@ namespace micro_os_plus::micro_test_plus
|
|
|
59
59
|
|
|
60
60
|
/**
|
|
61
61
|
* @brief The verbosity levels.
|
|
62
|
+
* @headerfile micro-test-plus.h <micro-os-plus/micro-test-plus.h>
|
|
62
63
|
*/
|
|
63
64
|
enum class verbosity
|
|
64
65
|
{
|
|
@@ -80,6 +81,7 @@ namespace micro_os_plus::micro_test_plus
|
|
|
80
81
|
/**
|
|
81
82
|
* @brief Reporter to display the test results. For failed
|
|
82
83
|
* tests it prints the actual values of the operands, with their types.
|
|
84
|
+
* @headerfile micro-test-plus.h <micro-os-plus/micro-test-plus.h>
|
|
83
85
|
*/
|
|
84
86
|
class test_reporter
|
|
85
87
|
{
|
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* This file is part of the µOS++
|
|
3
|
-
*
|
|
4
|
-
* Copyright (c) 2021 Liviu Ionescu.
|
|
2
|
+
* This file is part of the µOS++ project (https://micro-os-plus.github.io/).
|
|
3
|
+
* Copyright (c) 2021 Liviu Ionescu. All rights reserved.
|
|
5
4
|
*
|
|
6
5
|
* Permission to use, copy, modify, and/or distribute this software
|
|
7
6
|
* for any purpose is hereby granted, under the terms of the MIT license.
|
|
8
7
|
*
|
|
9
8
|
* If a copy of the license was not distributed with this file, it can
|
|
10
|
-
* be obtained from
|
|
9
|
+
* be obtained from https://opensource.org/licenses/mit.
|
|
11
10
|
*
|
|
12
11
|
* Major parts of the code are inspired from v1.1.8 of the Boost UT project,
|
|
13
12
|
* released under the terms of the Boost Version 1.0 Software License,
|
|
14
|
-
* which can be obtained from
|
|
13
|
+
* which can be obtained from https://www.boost.org/LICENSE_1_0.txt.
|
|
15
14
|
*/
|
|
16
15
|
|
|
17
16
|
#ifndef MICRO_TEST_PLUS_TEST_RUNNER_H_
|
|
@@ -46,6 +45,7 @@ namespace micro_os_plus::micro_test_plus
|
|
|
46
45
|
/**
|
|
47
46
|
* @brief The test runner. It maintains a list of test suites which
|
|
48
47
|
* automatically register themselves in their constructors.
|
|
48
|
+
* @headerfile micro-test-plus.h <micro-os-plus/micro-test-plus.h>
|
|
49
49
|
*/
|
|
50
50
|
class test_runner
|
|
51
51
|
{
|
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* This file is part of the µOS++
|
|
3
|
-
*
|
|
4
|
-
* Copyright (c) 2021 Liviu Ionescu.
|
|
2
|
+
* This file is part of the µOS++ project (https://micro-os-plus.github.io/).
|
|
3
|
+
* Copyright (c) 2021 Liviu Ionescu. All rights reserved.
|
|
5
4
|
*
|
|
6
5
|
* Permission to use, copy, modify, and/or distribute this software
|
|
7
6
|
* for any purpose is hereby granted, under the terms of the MIT license.
|
|
8
7
|
*
|
|
9
8
|
* If a copy of the license was not distributed with this file, it can
|
|
10
|
-
* be obtained from
|
|
9
|
+
* be obtained from https://opensource.org/licenses/mit.
|
|
11
10
|
*
|
|
12
11
|
* Major parts of the code are inspired from v1.1.8 of the Boost UT project,
|
|
13
12
|
* released under the terms of the Boost Version 1.0 Software License,
|
|
14
|
-
* which can be obtained from
|
|
13
|
+
* which can be obtained from https://www.boost.org/LICENSE_1_0.txt.
|
|
15
14
|
*/
|
|
16
15
|
|
|
17
16
|
#ifndef MICRO_TEST_PLUS_TEST_SUITE_H_
|
|
@@ -45,6 +44,7 @@ namespace micro_os_plus::micro_test_plus
|
|
|
45
44
|
|
|
46
45
|
/**
|
|
47
46
|
* @brief Base class for all test suites.
|
|
47
|
+
* @headerfile micro-test-plus.h <micro-os-plus/micro-test-plus.h>
|
|
48
48
|
*/
|
|
49
49
|
class test_suite_base
|
|
50
50
|
{
|
|
@@ -249,6 +249,7 @@ namespace micro_os_plus::micro_test_plus
|
|
|
249
249
|
* @ingroup micro-test-plus-test-suites
|
|
250
250
|
* @brief Test suites are classes that represent a named group of
|
|
251
251
|
* test cases which self register to the runner.
|
|
252
|
+
* @headerfile micro-test-plus.h <micro-os-plus/micro-test-plus.h>
|
|
252
253
|
*/
|
|
253
254
|
class test_suite : public test_suite_base
|
|
254
255
|
{
|
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* This file is part of the µOS++
|
|
3
|
-
*
|
|
4
|
-
* Copyright (c) 2021 Liviu Ionescu.
|
|
2
|
+
* This file is part of the µOS++ project (https://micro-os-plus.github.io/).
|
|
3
|
+
* Copyright (c) 2021 Liviu Ionescu. All rights reserved.
|
|
5
4
|
*
|
|
6
5
|
* Permission to use, copy, modify, and/or distribute this software
|
|
7
6
|
* for any purpose is hereby granted, under the terms of the MIT license.
|
|
8
7
|
*
|
|
9
8
|
* If a copy of the license was not distributed with this file, it can
|
|
10
|
-
* be obtained from
|
|
9
|
+
* be obtained from https://opensource.org/licenses/mit.
|
|
11
10
|
*
|
|
12
11
|
* Major parts of the code are inspired from v1.1.8 of the Boost UT project,
|
|
13
12
|
* released under the terms of the Boost Version 1.0 Software License,
|
|
14
|
-
* which can be obtained from
|
|
13
|
+
* which can be obtained from https://www.boost.org/LICENSE_1_0.txt.
|
|
15
14
|
*/
|
|
16
15
|
|
|
17
16
|
#ifndef MICRO_TEST_PLUS_TYPE_TRAITS_H_
|
|
@@ -45,11 +44,17 @@ namespace micro_os_plus::micro_test_plus
|
|
|
45
44
|
*/
|
|
46
45
|
namespace type_traits
|
|
47
46
|
{
|
|
47
|
+
/**
|
|
48
|
+
* @headerfile micro-test-plus.h <micro-os-plus/micro-test-plus.h>
|
|
49
|
+
*/
|
|
48
50
|
template <class...>
|
|
49
51
|
struct list
|
|
50
52
|
{
|
|
51
53
|
};
|
|
52
54
|
|
|
55
|
+
/**
|
|
56
|
+
* @headerfile micro-test-plus.h <micro-os-plus/micro-test-plus.h>
|
|
57
|
+
*/
|
|
53
58
|
template <class T, class...>
|
|
54
59
|
struct identity
|
|
55
60
|
{
|
|
@@ -69,6 +74,9 @@ namespace micro_os_plus::micro_test_plus
|
|
|
69
74
|
};
|
|
70
75
|
#endif
|
|
71
76
|
|
|
77
|
+
/**
|
|
78
|
+
* @headerfile micro-test-plus.h <micro-os-plus/micro-test-plus.h>
|
|
79
|
+
*/
|
|
72
80
|
template <class R, class... Args_T>
|
|
73
81
|
struct function_traits<R (*) (Args_T...)>
|
|
74
82
|
{
|
|
@@ -76,6 +84,9 @@ namespace micro_os_plus::micro_test_plus
|
|
|
76
84
|
using args = list<Args_T...>;
|
|
77
85
|
};
|
|
78
86
|
|
|
87
|
+
/**
|
|
88
|
+
* @headerfile micro-test-plus.h <micro-os-plus/micro-test-plus.h>
|
|
89
|
+
*/
|
|
79
90
|
template <class R, class... Args_T>
|
|
80
91
|
struct function_traits<R (Args_T...)>
|
|
81
92
|
{
|
|
@@ -83,6 +94,9 @@ namespace micro_os_plus::micro_test_plus
|
|
|
83
94
|
using args = list<Args_T...>;
|
|
84
95
|
};
|
|
85
96
|
|
|
97
|
+
/**
|
|
98
|
+
* @headerfile micro-test-plus.h <micro-os-plus/micro-test-plus.h>
|
|
99
|
+
*/
|
|
86
100
|
template <class R, class T, class... Args_T>
|
|
87
101
|
struct function_traits<R (T::*) (Args_T...)>
|
|
88
102
|
{
|
|
@@ -90,6 +104,9 @@ namespace micro_os_plus::micro_test_plus
|
|
|
90
104
|
using args = list<Args_T...>;
|
|
91
105
|
};
|
|
92
106
|
|
|
107
|
+
/**
|
|
108
|
+
* @headerfile micro-test-plus.h <micro-os-plus/micro-test-plus.h>
|
|
109
|
+
*/
|
|
93
110
|
template <class R, class T, class... Args_T>
|
|
94
111
|
struct function_traits<R (T::*) (Args_T...) const>
|
|
95
112
|
{
|
|
@@ -159,11 +176,17 @@ namespace micro_os_plus::micro_test_plus
|
|
|
159
176
|
constexpr auto is_convertible_v = is_convertible<From, To> (0);
|
|
160
177
|
#endif
|
|
161
178
|
|
|
179
|
+
/**
|
|
180
|
+
* @headerfile micro-test-plus.h <micro-os-plus/micro-test-plus.h>
|
|
181
|
+
*/
|
|
162
182
|
template <bool>
|
|
163
183
|
struct requires_
|
|
164
184
|
{
|
|
165
185
|
};
|
|
166
186
|
|
|
187
|
+
/**
|
|
188
|
+
* @headerfile micro-test-plus.h <micro-os-plus/micro-test-plus.h>
|
|
189
|
+
*/
|
|
167
190
|
template <>
|
|
168
191
|
struct requires_<true>
|
|
169
192
|
{
|
|
@@ -175,6 +198,7 @@ namespace micro_os_plus::micro_test_plus
|
|
|
175
198
|
|
|
176
199
|
/**
|
|
177
200
|
* @brief Empty base class of all operators.
|
|
201
|
+
* @headerfile micro-test-plus.h <micro-os-plus/micro-test-plus.h>
|
|
178
202
|
*/
|
|
179
203
|
struct op
|
|
180
204
|
{
|
|
@@ -183,6 +207,7 @@ namespace micro_os_plus::micro_test_plus
|
|
|
183
207
|
/**
|
|
184
208
|
* @brief A generic integral constant.
|
|
185
209
|
* It has a getter and a '-' operator to return the negative value.
|
|
210
|
+
* @headerfile micro-test-plus.h <micro-os-plus/micro-test-plus.h>
|
|
186
211
|
*/
|
|
187
212
|
template <auto N>
|
|
188
213
|
struct integral_constant : op
|
|
@@ -213,6 +238,7 @@ namespace micro_os_plus::micro_test_plus
|
|
|
213
238
|
* @brief A generic floating point constant, with custom size
|
|
214
239
|
* and precision.
|
|
215
240
|
* It has a getter and a '-' operator to return the negative value.
|
|
241
|
+
* @headerfile micro-test-plus.h <micro-os-plus/micro-test-plus.h>
|
|
216
242
|
*/
|
|
217
243
|
template <class T, auto N, auto D, auto Size, auto P = 1>
|
|
218
244
|
struct floating_point_constant : op
|
|
@@ -242,6 +268,9 @@ namespace micro_os_plus::micro_test_plus
|
|
|
242
268
|
}
|
|
243
269
|
};
|
|
244
270
|
|
|
271
|
+
/**
|
|
272
|
+
* @headerfile micro-test-plus.h <micro-os-plus/micro-test-plus.h>
|
|
273
|
+
*/
|
|
245
274
|
template <class T>
|
|
246
275
|
struct genuine_integral_value : op
|
|
247
276
|
{
|
|
@@ -271,6 +300,7 @@ namespace micro_os_plus::micro_test_plus
|
|
|
271
300
|
|
|
272
301
|
/**
|
|
273
302
|
* @brief Class defining a generic value, accessible via a getter.
|
|
303
|
+
* @headerfile micro-test-plus.h <micro-os-plus/micro-test-plus.h>
|
|
274
304
|
*/
|
|
275
305
|
template <class T, class = int>
|
|
276
306
|
struct value : type_traits::op
|
|
@@ -301,6 +331,7 @@ namespace micro_os_plus::micro_test_plus
|
|
|
301
331
|
* in addition to the actual value, has an epsilon, to use the
|
|
302
332
|
* desired precision during comparisons.
|
|
303
333
|
* If missing, the default is 1 / (10^decimals).
|
|
334
|
+
* @headerfile micro-test-plus.h <micro-os-plus/micro-test-plus.h>
|
|
304
335
|
*/
|
|
305
336
|
template <class T>
|
|
306
337
|
struct value<T,
|
package/meson.build
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
# -----------------------------------------------------------------------------
|
|
2
2
|
#
|
|
3
|
-
# This file is part of the µOS++
|
|
4
|
-
#
|
|
5
|
-
# Copyright (c) 2022 Liviu Ionescu
|
|
3
|
+
# This file is part of the µOS++ project (https://micro-os-plus.github.io/).
|
|
4
|
+
# Copyright (c) 2022 Liviu Ionescu. All rights reserved.
|
|
6
5
|
#
|
|
7
6
|
# Permission to use, copy, modify, and/or distribute this software
|
|
8
7
|
# for any purpose is hereby granted, under the terms of the MIT license.
|
|
9
8
|
#
|
|
10
9
|
# If a copy of the license was not distributed with this file, it can
|
|
11
|
-
# be obtained from https://opensource.org/licenses/
|
|
10
|
+
# be obtained from https://opensource.org/licenses/mit.
|
|
12
11
|
#
|
|
13
12
|
# -----------------------------------------------------------------------------
|
|
14
13
|
|