micro-test-plus 6.0.0
µTest++ Testing Framework
Loading...
Searching...
No Matches
deprecated.h
Go to the documentation of this file.
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
59
60#ifndef MICRO_OS_PLUS_MICRO_TEST_PLUS_DEPRECATED_H_
61#define MICRO_OS_PLUS_MICRO_TEST_PLUS_DEPRECATED_H_
62
63// ----------------------------------------------------------------------------
64
65#if defined(__cplusplus)
66
67// ----------------------------------------------------------------------------
68
69#if __has_include("micro-os-plus/project-config.h")
70#include "micro-os-plus/project-config.h"
71#endif // __has_include("micro-os-plus/project-config.h")
72
73#if __has_include("micro-os-plus/micro-test-plus-defines.h")
74#include "micro-os-plus/micro-test-plus-defines.h"
75#endif // __has_include("micro-os-plus/micro-test-plus-defines.h")
76
77#include "counters.h"
78#include "extension.h"
80#include "math.h"
81#include "reflection.h"
82#include "runner.h"
83#include "stopwatch.h"
84#include "test.h"
85
86#include <array>
87#include <concepts>
88#include <cstdint>
89#include <ctime>
90#include <limits>
91#include <string_view>
92#include <type_traits>
93
94// ----------------------------------------------------------------------------
95
96#if defined(MICRO_OS_PLUS_MICRO_TEST_PLUS_DEPRECATED_ENABLED)
97
98#if defined(__GNUC__)
99#pragma GCC diagnostic push
100
101#pragma GCC diagnostic ignored "-Waggregate-return"
102#pragma GCC diagnostic ignored "-Wconversion"
103#pragma GCC diagnostic ignored "-Wpadded"
104#if defined(__clang__)
105#pragma clang diagnostic ignored "-Wc++98-compat"
106#pragma clang diagnostic ignored "-Wc++98-compat-pedantic"
107#pragma clang diagnostic ignored "-Wc++20-compat"
108#pragma clang diagnostic ignored "-Wdocumentation"
109#pragma clang diagnostic ignored "-Wpre-c++17-compat"
110#endif // defined(__clang__)
111#endif // defined(__GNUC__)
112
113// ============================================================================
114
116{
117 // --------------------------------------------------------------------------
118 // The value wrappers and the parsing of the numeric literals, used only
119 // by the deprecated literals and value wrappers, and the constants that
120 // they define (moved here from `values.h` and `math.h`).
121
122 namespace detail::math
123 {
137 template <class T, class Exp_T>
138 [[nodiscard]] constexpr auto
139 pow (const T base, const Exp_T exp) noexcept -> T;
140
156 template <bool Fraction, char... Cs>
157 [[nodiscard]] consteval auto
158 count_literal_digits (void) -> std::size_t;
159
176 template <class T, char... Cs>
177 [[nodiscard]] consteval auto
178 num (void) -> T;
179
194 template <class T, char... Cs>
195 [[nodiscard]] consteval auto
196 den (void) -> T;
197
211 template <class T, char... Cs>
212 [[nodiscard]] consteval auto
213 den_size (void) -> T;
214
229 template <class T, class Value_T>
230 [[nodiscard]] constexpr auto
231 count_decimals (Value_T value) -> T;
232
246 template <class Value_T>
247 [[nodiscard]] constexpr auto
248 decimal_epsilon (Value_T value) -> Value_T;
249
258 {
265 unsigned long long value;
266
275
283 };
284
296 template <char... Cs>
297 [[nodiscard]] consteval auto
299
313 template <class T, char... Cs>
314 [[nodiscard]] consteval auto
315 integer_magnitude (void) -> unsigned long long;
316
317 // ------------------------------------------------------------------------
318 } // namespace detail::math
319
320 namespace detail
321 {
322 // ------------------------------------------------------------------------
323
350 template <class T>
352 {
360 using op_type = op;
361
368 using value_type = T;
369
375 constexpr explicit value_base (const T& v) noexcept;
376
382 [[nodiscard]] constexpr explicit
383 operator T () const noexcept;
384
397 [[nodiscard]] constexpr const T&
398 get (void) const noexcept;
399
400 private:
409 };
410
429 template <auto N>
430 struct integral_constant : value_base<decltype (N)>
431 {
438 static constexpr auto value = N;
439
446 constexpr integral_constant (void) noexcept;
447
461 [[nodiscard]] constexpr auto
462 operator- () const noexcept;
463 };
464
481 template <class T>
483 {
493 [[nodiscard]] constexpr auto
494 operator- () const noexcept;
495 };
496
513 template <class T, char... Cs>
514 [[nodiscard]] constexpr auto
515 integral_literal (void);
516
554 template <class T, auto N, auto D, auto Size, auto P = 1>
556 {
557 static_assert (P == 1 || P == -1,
558 "floating_point_constant: P must be +1 or -1");
559
567 using value_type = T;
568
576 static constexpr auto epsilon = T (1) / math::pow (T (10), Size);
577
584 static constexpr auto value
585 = T (P) * (T (N) + (T (D) / math::pow (T (10), Size)));
586
592 [[nodiscard]] constexpr explicit
593 operator T () const noexcept;
594
602 [[nodiscard]] constexpr T
603 get (void) const noexcept;
604
610 [[nodiscard]] constexpr auto
611 operator- () const noexcept;
612 };
613
627 template <class T>
628 struct value : value_base<T>
629 {
638 constexpr value (const T& _value) noexcept;
639 };
640
660 template <class T>
661 requires std::floating_point<T>
662 struct value<T> : value_base<T>
663 {
674 T epsilon = T{};
675
676 // Note: These constructor bodies are defined inline rather than
677 // out-of-line in deprecated-inlines.h. Clang 16 has a deficiency where
678 // it fails to match out-of-line constructor definitions to a
679 // `requires`-constrained partial specialisation: it either rejects
680 // the `requires` clause on the definition as differing from the
681 // declaration, or — when the clause is omitted — incorrectly matches
682 // the definition against the primary template instead of this
683 // specialisation. Keeping the bodies here avoids both failure modes.
684
695 constexpr value (const T& _value, const T precision) noexcept
696 : value_base<T>{ _value }, epsilon{ precision }
697 {
698 }
699
712 constexpr value (const T& val)
713 : value{ val, math::decimal_epsilon (val) }
714 {
715 }
716 };
717
718 // ------------------------------------------------------------------------
719
743 struct named_bool : op
744 {
751 using value_type = bool;
752
758 constexpr explicit named_bool (std::string_view name) noexcept;
759
767 [[nodiscard]] constexpr
768 operator value_type () const noexcept;
769
777 [[nodiscard]] constexpr std::string_view
778 name (void) const noexcept;
779
780 private:
787 std::string_view name_;
788 };
789
790 // ------------------------------------------------------------------------
791 } // namespace detail
792
793 // --------------------------------------------------------------------------
794 // The logical functions, now `negate()`, `all_of()`, and `any_of()`, in
795 // `function-comparators.h`.
796
801
816 template <class Expr_T>
817 [[deprecated ("use negate() (since 6.0.0)"), nodiscard]] constexpr auto
818 _not (Expr_T&& expr);
819
837 template <class Lhs_T, class Rhs_T>
838 [[deprecated ("use all_of() (since 6.0.0)"), nodiscard]] constexpr auto
839 _and (Lhs_T&& lhs, Rhs_T&& rhs);
840
858 template <class Lhs_T, class Rhs_T>
859 [[deprecated ("use any_of() (since 6.0.0)"), nodiscard]] constexpr auto
860 _or (Lhs_T&& lhs, Rhs_T&& rhs);
861
862 // --------------------------------------------------------------------------
863 // The `mut()` helper, not used by the framework.
864
882 template <class T>
883 [[deprecated ("use const_cast<T&> (since 6.0.0)"), nodiscard]] constexpr auto
884 mut (const T& t) noexcept -> T&;
885
889
890 // --------------------------------------------------------------------------
891
939 namespace operators
940 {
953 template <class Lhs_T, class Rhs_T>
955 std::remove_cvref_t<Rhs_T>>
956 [[deprecated ("use eq() (since 6.0.0)"), nodiscard]] constexpr auto
957 operator== (Lhs_T&& lhs, Rhs_T&& rhs);
958
971 template <class Lhs_T, class Rhs_T>
973 std::remove_cvref_t<Rhs_T>>
974 [[deprecated ("use ne() (since 6.0.0)"), nodiscard]] constexpr auto
975 operator!= (Lhs_T&& lhs, Rhs_T&& rhs);
976
989 template <class Lhs_T, class Rhs_T>
991 std::remove_cvref_t<Rhs_T>>
992 [[deprecated ("use gt() (since 6.0.0)"), nodiscard]] constexpr auto
993 operator> (Lhs_T&& lhs, Rhs_T&& rhs);
994
1007 template <class Lhs_T, class Rhs_T>
1009 std::remove_cvref_t<Rhs_T>>
1010 [[deprecated ("use ge() (since 6.0.0)"), nodiscard]] constexpr auto
1011 operator>= (Lhs_T&& lhs, Rhs_T&& rhs);
1012
1025 template <class Lhs_T, class Rhs_T>
1027 std::remove_cvref_t<Rhs_T>>
1028 [[deprecated ("use lt() (since 6.0.0)"), nodiscard]] constexpr auto
1029 operator< (Lhs_T&& lhs, Rhs_T&& rhs);
1030
1043 template <class Lhs_T, class Rhs_T>
1045 std::remove_cvref_t<Rhs_T>>
1046 [[deprecated ("use le() (since 6.0.0)"), nodiscard]] constexpr auto
1047 operator<= (Lhs_T&& lhs, Rhs_T&& rhs);
1048
1061 template <class Lhs_T, class Rhs_T>
1063 std::remove_cvref_t<Rhs_T>>
1064 [[deprecated ("use all_of() (since 6.0.0)"), nodiscard]] constexpr auto
1065 operator and (Lhs_T&& lhs, Rhs_T&& rhs);
1066
1079 template <class Lhs_T, class Rhs_T>
1081 std::remove_cvref_t<Rhs_T>>
1082 [[deprecated ("use any_of() (since 6.0.0)"), nodiscard]] constexpr auto
1083 operator or (Lhs_T&& lhs, Rhs_T&& rhs);
1084
1096 template <class T>
1098 [[deprecated ("use negate() (since 6.0.0)"), nodiscard]] constexpr auto
1099 operator not(T&& t);
1100
1101 // ------------------------------------------------------------------------
1102 } // namespace operators
1103
1104 // --------------------------------------------------------------------------
1105
1132 namespace literals
1133 {
1144 template <char... Cs>
1145 [[deprecated (
1146 "pass plain values to eq() and the other comparators (since 6.0.0)"),
1147 nodiscard]] constexpr auto
1148 operator""_i ();
1149
1160 template <char... Cs>
1161 [[deprecated (
1162 "pass plain values to eq() and the other comparators (since 6.0.0)"),
1163 nodiscard]] constexpr auto
1164 operator""_s ();
1165
1176 template <char... Cs>
1177 [[deprecated (
1178 "pass plain values to eq() and the other comparators (since 6.0.0)"),
1179 nodiscard]] constexpr auto
1180 operator""_c ();
1181
1193 template <char... Cs>
1194 [[deprecated (
1195 "pass plain values to eq() and the other comparators (since 6.0.0)"),
1196 nodiscard]] constexpr auto
1197 operator""_sc ();
1198
1209 template <char... Cs>
1210 [[deprecated (
1211 "pass plain values to eq() and the other comparators (since 6.0.0)"),
1212 nodiscard]] constexpr auto
1213 operator""_l ();
1214
1226 template <char... Cs>
1227 [[deprecated (
1228 "pass plain values to eq() and the other comparators (since 6.0.0)"),
1229 nodiscard]] constexpr auto
1230 operator""_ll ();
1231
1243 template <char... Cs>
1244 [[deprecated (
1245 "pass plain values to eq() and the other comparators (since 6.0.0)"),
1246 nodiscard]] constexpr auto
1247 operator""_u ();
1248
1260 template <char... Cs>
1261 [[deprecated (
1262 "pass plain values to eq() and the other comparators (since 6.0.0)"),
1263 nodiscard]] constexpr auto
1264 operator""_uc ();
1265
1277 template <char... Cs>
1278 [[deprecated (
1279 "pass plain values to eq() and the other comparators (since 6.0.0)"),
1280 nodiscard]] constexpr auto
1281 operator""_us ();
1282
1294 template <char... Cs>
1295 [[deprecated (
1296 "pass plain values to eq() and the other comparators (since 6.0.0)"),
1297 nodiscard]] constexpr auto
1298 operator""_ul ();
1299
1311 template <char... Cs>
1312 [[deprecated (
1313 "pass plain values to eq() and the other comparators (since 6.0.0)"),
1314 nodiscard]] constexpr auto
1315 operator""_ull ();
1316
1327 template <char... Cs>
1328 [[deprecated (
1329 "pass plain values to eq() and the other comparators (since 6.0.0)"),
1330 nodiscard]] constexpr auto
1331 operator""_i8 ();
1332
1343 template <char... Cs>
1344 [[deprecated (
1345 "pass plain values to eq() and the other comparators (since 6.0.0)"),
1346 nodiscard]] constexpr auto
1347 operator""_i16 ();
1348
1359 template <char... Cs>
1360 [[deprecated (
1361 "pass plain values to eq() and the other comparators (since 6.0.0)"),
1362 nodiscard]] constexpr auto
1363 operator""_i32 ();
1364
1375 template <char... Cs>
1376 [[deprecated (
1377 "pass plain values to eq() and the other comparators (since 6.0.0)"),
1378 nodiscard]] constexpr auto
1379 operator""_i64 ();
1380
1391 template <char... Cs>
1392 [[deprecated (
1393 "pass plain values to eq() and the other comparators (since 6.0.0)"),
1394 nodiscard]] constexpr auto
1395 operator""_u8 ();
1396
1408 template <char... Cs>
1409 [[deprecated (
1410 "pass plain values to eq() and the other comparators (since 6.0.0)"),
1411 nodiscard]] constexpr auto
1412 operator""_u16 ();
1413
1425 template <char... Cs>
1426 [[deprecated (
1427 "pass plain values to eq() and the other comparators (since 6.0.0)"),
1428 nodiscard]] constexpr auto
1429 operator""_u32 ();
1430
1442 template <char... Cs>
1443 [[deprecated (
1444 "pass plain values to eq() and the other comparators (since 6.0.0)"),
1445 nodiscard]] constexpr auto
1446 operator""_u64 ();
1447
1458 template <char... Cs>
1459 [[deprecated ("use approx() for tolerances (since 6.0.0)"),
1460 nodiscard]] constexpr auto
1461 operator""_f ();
1462
1473 template <char... Cs>
1474 [[deprecated ("use approx() for tolerances (since 6.0.0)"),
1475 nodiscard]] constexpr auto
1476 operator""_d ();
1477
1489 template <char... Cs>
1490 [[deprecated ("use approx() for tolerances (since 6.0.0)"),
1491 nodiscard]] constexpr auto
1492 operator""_ld ();
1493
1504 [[deprecated ("use a plain bool and a check message (since 6.0.0)"),
1505 nodiscard]] constexpr auto
1506 operator""_b (const char* name, decltype (sizeof ("")) size);
1507
1508 // ------------------------------------------------------------------------
1509 } // namespace literals
1510
1511 // --------------------------------------------------------------------------
1512
1517
1553
1563 using to_b [[deprecated (
1564 "pass plain values to eq() and the other comparators (since 6.0.0)")]]
1566
1576 using to_c [[deprecated (
1577 "pass plain values to eq() and the other comparators (since 6.0.0)")]]
1579
1589 using to_sc [[deprecated (
1590 "pass plain values to eq() and the other comparators (since 6.0.0)")]]
1592
1602 using to_s [[deprecated (
1603 "pass plain values to eq() and the other comparators (since 6.0.0)")]]
1605
1615 using to_i [[deprecated (
1616 "pass plain values to eq() and the other comparators (since 6.0.0)")]]
1618
1628 using to_l [[deprecated (
1629 "pass plain values to eq() and the other comparators (since 6.0.0)")]]
1631
1641 using to_ll [[deprecated (
1642 "pass plain values to eq() and the other comparators (since 6.0.0)")]]
1644
1654 using to_u [[deprecated (
1655 "pass plain values to eq() and the other comparators (since 6.0.0)")]]
1657
1667 using to_uc [[deprecated (
1668 "pass plain values to eq() and the other comparators (since 6.0.0)")]]
1670
1680 using to_us [[deprecated (
1681 "pass plain values to eq() and the other comparators (since 6.0.0)")]]
1693 using to_ul [[deprecated (
1694 "pass plain values to eq() and the other comparators (since 6.0.0)")]]
1696
1706 using to_ull [[deprecated (
1707 "pass plain values to eq() and the other comparators (since 6.0.0)")]]
1709
1719 using to_i8 [[deprecated (
1720 "pass plain values to eq() and the other comparators (since 6.0.0)")]]
1722
1732 using to_i16 [[deprecated (
1733 "pass plain values to eq() and the other comparators (since 6.0.0)")]]
1735
1745 using to_i32 [[deprecated (
1746 "pass plain values to eq() and the other comparators (since 6.0.0)")]]
1748
1758 using to_i64 [[deprecated (
1759 "pass plain values to eq() and the other comparators (since 6.0.0)")]]
1761
1771 using to_u8 [[deprecated (
1772 "pass plain values to eq() and the other comparators (since 6.0.0)")]]
1774
1784 using to_u16 [[deprecated (
1785 "pass plain values to eq() and the other comparators (since 6.0.0)")]]
1787
1797 using to_u32 [[deprecated (
1798 "pass plain values to eq() and the other comparators (since 6.0.0)")]]
1800
1810 using to_u64 [[deprecated (
1811 "pass plain values to eq() and the other comparators (since 6.0.0)")]]
1813
1823 using to_f [[deprecated ("use approx() for tolerances (since 6.0.0)")]]
1835 using to_d [[deprecated ("use approx() for tolerances (since 6.0.0)")]]
1837
1847 using to_ld [[deprecated ("use approx() for tolerances (since 6.0.0)")]]
1849
1853
1857
1871 * encapsulated value is treated as the specified type within the framework,
1872 * for the types without a `to_*` alias, including the application types;
1873 * with the operators of the `operators` namespace, the comparisons are
1874 * then reported with their operands.
1875 *
1876 * @par Example
1877 *
1878 * @code
1879 * namespace mt = micro_os_plus::micro_test_plus;
1880 *
1881 * MyType obj;
1882 * // Explicitly treat obj as MyType for test comparison.
1883 * auto wrapped = mt::to_t<MyType>{obj};
1884 * @endcode
1885 *
1886 * @par Replacement
1887 * Pass the plain value to the function comparators `eq()`, `ne()`,
1888 * `gt()`, `ge()`, `lt()`, and `le()` instead; the application types
1889 * are reported with the `operator<<` of `expression_formatter`.
1890 *
1891 * @headerfile micro-test-plus.h "micro-os-plus/micro-test-plus.h"
1892 */
1893 template <class T>
1894 struct [[deprecated (
1895 "pass plain values to eq() and the other comparators (since 6.0.0)")]]
1896 to_t : detail::value<T>
1897 {
1903 constexpr explicit to_t (const T& t);
1904 };
1905
1910
1945 template <class T>
1946 requires std::is_floating_point_v<T>
1947 [[deprecated ("use approx (lhs, rhs, epsilon) (since 6.0.0)"),
1948 nodiscard]] constexpr auto
1949 approx (T value, std::type_identity_t<T> epsilon) noexcept
1951
1955
1956#if defined(__GNUC__)
1957#pragma GCC diagnostic push
1958// The aliases refer to the `to_*` names, deprecated too.
1959#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
1960#endif // defined(__GNUC__)
1961
1966
1991
1999 using _b [[deprecated (
2000 "pass plain values to eq() and the other comparators (since 6.0.0)")]]
2001 = to_b;
2002
2010 using _c [[deprecated (
2011 "pass plain values to eq() and the other comparators (since 6.0.0)")]]
2012 = to_c;
2013
2021 using _sc [[deprecated (
2022 "pass plain values to eq() and the other comparators (since 6.0.0)")]]
2023 = to_sc;
2024
2032 using _s [[deprecated (
2033 "pass plain values to eq() and the other comparators (since 6.0.0)")]]
2034 = to_s;
2035
2043 using _i [[deprecated (
2044 "pass plain values to eq() and the other comparators (since 6.0.0)")]]
2045 = to_i;
2054 using _l [[deprecated (
2055 "pass plain values to eq() and the other comparators (since 6.0.0)")]]
2057
2065 using _ll [[deprecated (
2066 "pass plain values to eq() and the other comparators (since 6.0.0)")]]
2067 = to_ll;
2068
2076 using _u [[deprecated (
2077 "pass plain values to eq() and the other comparators (since 6.0.0)")]]
2078 = to_u;
2079
2087 using _uc [[deprecated (
2088 "pass plain values to eq() and the other comparators (since 6.0.0)")]]
2089 = to_uc;
2090
2098 using _us [[deprecated (
2099 "pass plain values to eq() and the other comparators (since 6.0.0)")]]
2100 = to_us;
2101
2109 using _ul [[deprecated (
2110 "pass plain values to eq() and the other comparators (since 6.0.0)")]]
2111 = to_ul;
2112
2120 using _ull [[deprecated (
2121 "pass plain values to eq() and the other comparators (since 6.0.0)")]]
2122 = to_ull;
2123
2131 using _i8 [[deprecated (
2132 "pass plain values to eq() and the other comparators (since 6.0.0)")]]
2133 = to_i8;
2134
2142 using _i16 [[deprecated (
2143 "pass plain values to eq() and the other comparators (since 6.0.0)")]]
2144 = to_i16;
2145
2153 using _i32 [[deprecated (
2154 "pass plain values to eq() and the other comparators (since 6.0.0)")]]
2155 = to_i32;
2164 using _i64 [[deprecated (
2165 "pass plain values to eq() and the other comparators (since 6.0.0)")]]
2167
2175 using _u8 [[deprecated (
2176 "pass plain values to eq() and the other comparators (since 6.0.0)")]]
2177 = to_u8;
2178
2186 using _u16 [[deprecated (
2187 "pass plain values to eq() and the other comparators (since 6.0.0)")]]
2188 = to_u16;
2189
2197 using _u32 [[deprecated (
2198 "pass plain values to eq() and the other comparators (since 6.0.0)")]]
2199 = to_u32;
2200
2208 using _u64 [[deprecated (
2209 "pass plain values to eq() and the other comparators (since 6.0.0)")]]
2210 = to_u64;
2211
2219 using _f [[deprecated ("use approx() for tolerances (since 6.0.0)")]] = to_f;
2220
2228 using _d [[deprecated ("use approx() for tolerances (since 6.0.0)")]] = to_d;
2229
2237 using _ld [[deprecated ("use approx() for tolerances (since 6.0.0)")]]
2238 = to_ld;
2239
2252 template <class T>
2253 using _t [[deprecated (
2254 "pass plain values to eq() and the other comparators (since 6.0.0)")]]
2255 = to_t<T>;
2256
2260
2264
2265#if defined(__GNUC__)
2266#pragma GCC diagnostic pop
2267#endif // defined(__GNUC__)
2268
2269 // ==========================================================================
2270 // The test case class, now `test_case`, in `test.h`.
2271
2279
2282 using subtest [[deprecated ("use test_case (since 6.0.0)")]] = test_case;
2283
2284 // ==========================================================================
2285 // The runner class, now `runner`, in `runner.h`.
2286
2295 using static_runner [[deprecated ("use runner (since 6.0.0)")]] = runner;
2296
2297 // --------------------------------------------------------------------------
2298
2299 namespace reflection
2300 {
2301 // ------------------------------------------------------------------------
2302 // Now `utility::extract_file_name()`, in `utility.h`.
2303
2318 [[deprecated ("use utility::extract_file_name() (since 6.0.0)"),
2319 nodiscard]] const char*
2320 short_name (const char* name) noexcept;
2321
2322 // ------------------------------------------------------------------------
2323 } // namespace reflection
2324
2325 // --------------------------------------------------------------------------
2326
2327 namespace detail
2328 {
2329 // ========================================================================
2330 // The counters class, now `counters`, in `counters.h`.
2331
2336 * @details
2337 * The v5.0.1 name of the class returned by `totals()`, renamed since
2338 * the suites and the test cases own one too, not only the runner.
2339 */
2340 using runner_totals [[deprecated ("use counters (since 6.0.0)")]]
2341 = counters;
2342
2343 // ========================================================================
2344 // The timings classes, now `stopwatch`, in `stopwatch.h`.
2345
2358 using timestamps [[deprecated ("the timings are internal (since 6.0.0)")]]
2359 = stopwatch;
2360
2361 // ========================================================================
2362
2382 class [[deprecated ("the timings are internal (since 6.0.0)")]] timestamp
2384 public:
2392 timestamp (void) noexcept;
2393
2403 timestamp (const timespec& ts) noexcept;
2404
2411 timestamp (const timestamp&) = default;
2412
2419 timestamp (timestamp&&) = default;
2420
2429 timestamp&
2430 operator= (const timestamp&)
2431 = default;
2432
2442 timestamp&
2443 operator= (timestamp&&)
2444 = default;
2445
2450
2452 ~timestamp () = default;
2453
2465 [[nodiscard]] bool
2466 has_clock (void) const noexcept;
2467
2475 [[nodiscard]] timespec&
2476 value (void) noexcept;
2477
2485 [[nodiscard]] const timespec&
2486 value (void) const noexcept;
2487
2488 protected:
2495 timespec value_{};
2496 };
2497
2498 // ------------------------------------------------------------------------
2499 } // namespace detail
2500
2501 // --------------------------------------------------------------------------
2502 // The concepts, now in the `extension` namespace, in `extension.h`.
2503 // Kept last, since the pragma below applies to the rest of the file.
2504
2539
2540 // --------------------------------------------------------------------------
2541
2542#if defined(__GNUC__)
2543 // GCC reports the partial specialisations of `function_traits` below,
2544 // since they name the deprecated namespace.
2545#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
2546#endif // defined(__GNUC__)
2547
2548 // --------------------------------------------------------------------------
2549
2550 namespace
2551 [[deprecated ("use the extension namespace (since 6.0.0)")]] type_traits
2552 {
2553 // ------------------------------------------------------------------------
2554 // Concepts, now in the `extension` and `detail` namespaces.
2555
2556 using extension::any_op;
2559 using extension::is_op;
2561
2563
2581 template <class T>
2582 concept has_npos = requires { T::npos; };
2583
2592 * Restored with its v5.0.1 definition, satisfied by any type with a
2593 * member named `value`, static or not, including the application
2594 * types, so that the v5.0.1 code that uses it keeps its result. It
2595 * is not the concept used by the framework, `detail::has_value`,
2596 * which is satisfied only by the framework types, so that the
2597 * application types with a `value` member are compared as values.
2598 *
2599 * @deprecated there is no replacement; the concept used by the
2600 * framework is internal (since 6.0.0)
2601 */
2602 template <class T>
2603 concept has_value = requires (const T& t) { t.value; };
2604
2610 * @tparam T The type to be checked.
2611 *
2612 * @details
2613 * The v5.0.1 name of `std::floating_point`, which the framework now
2614 * uses directly.
2615 *
2616 * @deprecated use `std::floating_point` (since 6.0.0)
2617 */
2618 template <class T>
2619 concept is_floating_point = std::floating_point<T>;
2620
2621 // ------------------------------------------------------------------------
2622 // Helpers removed from the framework, restored as in v5.0.1.
2623
2636 template <class... Types>
2637 struct list
2638 {
2639 };
2640
2645
2654 template <class T, class... Extra>
2655 struct identity
2656 {
2660 * @details
2661 * The additional template arguments do not affect it.
2662 */
2663 using type = T;
2664 };
2665
2679
2681 template <class T>
2682 struct function_traits
2683#if !defined(__DOXYGEN__)
2684 // Hidden from Doxygen, which reports a recursive class relation.
2685 // https://github.com/doxygen/doxygen/issues/9915
2686 : function_traits<decltype (&T::operator())>
2687#endif // !defined(__DOXYGEN__)
2688 {
2689 };
2690
2693 * @brief Deprecated traits of the function pointers.
2694 *
2695 * @tparam R The return type.
2696 * @tparam Args_T The parameter types.
2697 *
2698 * @details
2699 * Exposes the return type and the parameter types of a pointer to a
2700 * free function.
2702 * @deprecated not replaced (since 6.0.0)
2703 */
2704 template <class R, class... Args_T>
2705 struct function_traits<R (*) (Args_T...)>
2706 {
2712
2713 using result_type = R;
2714
2722 using args = list<Args_T...>;
2723 };
2724
2729 * @tparam R The return type.
2730 * @tparam Args_T The parameter types.
2731 *
2732 * @details
2733 * Exposes the return type and the parameter types of a function type.
2734 *
2735 * @deprecated not replaced (since 6.0.0)
2737 template <class R, class... Args_T>
2738 struct function_traits<R (Args_T...)>
2739 {
2746 using result_type = R;
2747
2755 using args = list<Args_T...>;
2756 };
2757
2764 * @tparam Args_T The parameter types.
2765 *
2766 * @details
2767 * Exposes the return type and the parameter types of a pointer to a
2768 * non-`const` member function.
2769 *
2770 * @deprecated not replaced (since 6.0.0)
2771 */
2772 template <class R, class T, class... Args_T>
2773 struct function_traits<R (T::*) (Args_T...)>
2774 {
2781 using result_type = R;
2782
2783
2790 using args = list<Args_T...>;
2791 };
2792
2808 template <class R, class T, class... Args_T>
2809 struct function_traits<R (T::*) (Args_T...) const>
2810 {
2817 using result_type = R;
2818
2826 using args = list<Args_T...>;
2827 };
2828
2829 // ------------------------------------------------------------------------
2830 // The base of the expressions and the value wrappers, now in `detail`.
2831
2834 using detail::op;
2835 using detail::value;
2836
2851 template <class T>
2852 using value_base_ = detail::value_base<T>;
2853
2867 template <class T>
2868 using genuine_integral_value = detail::value<T>;
2869
2870 // ------------------------------------------------------------------------
2871 } // namespace type_traits
2872
2873 // --------------------------------------------------------------------------
2874} // namespace micro_os_plus::micro_test_plus
2875
2876#if defined(__GNUC__)
2877#pragma GCC diagnostic pop
2878#endif // defined(__GNUC__)
2879
2880#endif // defined(MICRO_OS_PLUS_MICRO_TEST_PLUS_DEPRECATED_ENABLED)
2881
2882// ----------------------------------------------------------------------------
2883
2884#endif // defined(__cplusplus)
2885
2886// ============================================================================
2887// Templates, inlines & constexpr implementations.
2888
2890
2891// ----------------------------------------------------------------------------
2892
2893#endif // MICRO_OS_PLUS_MICRO_TEST_PLUS_DEPRECATED_H_
2894
2895// ----------------------------------------------------------------------------
Aggregated check and test case counters for a node in the test tree.
Definition counters.h:123
Measures the elapsed time of an operation.
Definition stopwatch.h:138
timestamp(void) noexcept
Constructs a timestamp with the current time.
The test runner for the µTest++ framework.
Definition runner.h:187
A named, runnable test case that lives inside a suite.
Definition test.h:1362
Concept satisfied when T provides both begin() and end() member functions returning an iterator and i...
Definition extension.h:532
Concept satisfied when at least one of two types is a framework expression type.
Definition extension.h:369
Concept satisfied when a type can be used as a test expression in expect() or require().
Definition extension.h:403
Deprecated concept satisfied when T is a framework floating-point wrapper with a tolerance.
Definition extension.h:349
Concept satisfied when a type is a framework expression type.
Definition extension.h:320
Concept satisfied when a type can be appended to the message of a check result via operator<<.
Definition extension.h:433
Deprecated concept satisfied when T provides a npos member.
Deprecated concept satisfied when T has a member named value.
Deprecated concept satisfied when T is a floating-point type.
C++ header file with declarations for the µTest++ counters.
C++ header file with inline implementations for the deprecated µTest++ definitions.
C++ header file with declarations for the µTest++ extension concepts.
C++ header file with declarations for the µTest++ function comparators.
detail::value< long > to_l
Deprecated strongly-typed wrapper for long values.
to_sc _sc
Deprecated strongly-typed wrapper for signed char values, the v5.0.1 name of to_sc.
detail::value< long long > to_ll
Deprecated strongly-typed wrapper for long long values.
to_u64 _u64
Deprecated strongly-typed wrapper for std::uint64_t values, the v5.0.1 name of to_u64.
to_t< T > _t
Deprecated generic strongly-typed wrapper, the v5.0.1 name of to_t.
detail::value< std::int32_t > to_i32
Deprecated strongly-typed wrapper for std::int32_t values.
to_f _f
Deprecated strongly-typed wrapper for float values, the v5.0.1 name of to_f.
to_i8 _i8
Deprecated strongly-typed wrapper for std::int8_t values, the v5.0.1 name of to_i8.
to_i64 _i64
Deprecated strongly-typed wrapper for std::int64_t values, the v5.0.1 name of to_i64.
to_ul _ul
Deprecated strongly-typed wrapper for unsigned long values, the v5.0.1 name of to_ul.
to_l _l
Deprecated strongly-typed wrapper for long values, the v5.0.1 name of to_l.
to_s _s
Deprecated strongly-typed wrapper for short values, the v5.0.1 name of to_s.
to_u32 _u32
Deprecated strongly-typed wrapper for std::uint32_t values, the v5.0.1 name of to_u32.
detail::value< std::int8_t > to_i8
Deprecated strongly-typed wrapper for std::int8_t values.
detail::value< float > to_f
Deprecated strongly-typed wrapper for float values.
detail::value< bool > to_b
Deprecated strongly-typed wrapper for bool values.
detail::value< std::int16_t > to_i16
Deprecated strongly-typed wrapper for std::int16_t values.
detail::value< unsigned long > to_ul
Deprecated strongly-typed wrapper for unsigned long values.
to_us _us
Deprecated strongly-typed wrapper for unsigned short values, the v5.0.1 name of to_us.
detail::value< char > to_c
Deprecated strongly-typed wrapper for char values.
to_d _d
Deprecated strongly-typed wrapper for double values, the v5.0.1 name of to_d.
to_i _i
Deprecated strongly-typed wrapper for int values, the v5.0.1 name of to_i.
detail::value< std::uint16_t > to_u16
Deprecated strongly-typed wrapper for std::uint16_t values.
detail::value< unsigned short > to_us
Deprecated strongly-typed wrapper for unsigned short values.
to_i32 _i32
Deprecated strongly-typed wrapper for std::int32_t values, the v5.0.1 name of to_i32.
detail::value< double > to_d
Deprecated strongly-typed wrapper for double values.
to_u16 _u16
Deprecated strongly-typed wrapper for std::uint16_t values, the v5.0.1 name of to_u16.
to_ll _ll
Deprecated strongly-typed wrapper for long long values, the v5.0.1 name of to_ll.
detail::value< unsigned > to_u
Deprecated strongly-typed wrapper for unsigned values.
to_uc _uc
Deprecated strongly-typed wrapper for unsigned char values, the v5.0.1 name of to_uc.
to_u _u
Deprecated strongly-typed wrapper for unsigned values, the v5.0.1 name of to_u.
detail::value< short > to_s
Deprecated strongly-typed wrapper for short values.
detail::value< std::uint8_t > to_u8
Deprecated strongly-typed wrapper for std::uint8_t values.
to_ld _ld
Deprecated strongly-typed wrapper for long double values, the v5.0.1 name of to_ld.
to_i16 _i16
Deprecated strongly-typed wrapper for std::int16_t values, the v5.0.1 name of to_i16.
to_b _b
Deprecated strongly-typed wrapper for bool values, the v5.0.1 name of to_b.
to_ull _ull
Deprecated strongly-typed wrapper for unsigned long long values, the v5.0.1 name of to_ull.
detail::value< unsigned char > to_uc
Deprecated strongly-typed wrapper for unsigned char values.
detail::value< unsigned long long > to_ull
Deprecated strongly-typed wrapper for unsigned long long values.
detail::value< signed char > to_sc
Deprecated strongly-typed wrapper for signed char values.
detail::value< std::int64_t > to_i64
Deprecated strongly-typed wrapper for std::int64_t values.
detail::value< long double > to_ld
Deprecated strongly-typed wrapper for long double values.
to_u8 _u8
Deprecated strongly-typed wrapper for std::uint8_t values, the v5.0.1 name of to_u8.
detail::value< int > to_i
Deprecated strongly-typed wrapper for int values.
detail::value< std::uint64_t > to_u64
Deprecated strongly-typed wrapper for std::uint64_t values.
to_c _c
Deprecated strongly-typed wrapper for char values, the v5.0.1 name of to_c.
detail::value< std::uint32_t > to_u32
Deprecated strongly-typed wrapper for std::uint32_t values.
constexpr auto mut(const T &t) noexcept -> T &
Deprecated generic mutator to remove const qualification from a reference.
constexpr auto _or(Lhs_T &&lhs, Rhs_T &&rhs)
Deprecated generic logical (inclusive) or operation, the v5.0.1 name of any_of().
constexpr auto _and(Lhs_T &&lhs, Rhs_T &&rhs)
Deprecated generic logical and operation, the v5.0.1 name of all_of().
constexpr auto _not(Expr_T &&expr)
Deprecated generic logical not operation, the v5.0.1 name of negate().
constexpr auto approx(T value, std::type_identity_t< T > epsilon) noexcept -> detail::value< T >
Deprecated wrapping of a floating-point value with an explicit comparison tolerance.
test_case subtest
Deprecated name of test_case.
runner static_runner
Deprecated name of runner.
stopwatch timestamps
Deprecated name of stopwatch.
counters runner_totals
Deprecated name of counters.
C++ header file with declarations for the µTest++ mathematical utilities.
Internal mathematical utilities for the µTest++ testing framework.
Definition deprecated.h:123
constexpr auto pow(const T base, const Exp_T exp) noexcept -> T
Generic exponentiation function to compute the power of a base raised to an exponent.
consteval auto den(void) -> T
Computes the decimal part of a number represented as an array of characters.
consteval auto den_size(void) -> T
Counts the decimal places of a number represented as an array of characters.
consteval auto integer_magnitude(void) -> unsigned long long
Computes the value of an integer literal of type T, before any negation.
consteval auto num(void) -> T
Computes the integral part of a decimal floating-point number represented as an array of characters.
consteval auto parse_integer_literal(void) -> integer_literal
Parses the characters of an integer literal.
constexpr auto count_decimals(Value_T value) -> T
Computes the number of decimal places of a value, with a precision of about seven digits.
constexpr auto decimal_epsilon(Value_T value) -> Value_T
Computes the default comparison tolerance of a floating-point value, one unit of its last decimal.
consteval auto count_literal_digits(void) -> std::size_t
Counts the decimal digits of a floating-point literal, before or after the decimal point.
Internal implementation details for the µTest++ framework.
constexpr auto integral_literal(void)
Creates the compile-time constant of an integer literal.
Deprecated user-defined literals of the test checks.
Deprecated comparison and logical operators of the test checks.
Reflection utilities for the µTest++ testing framework.
Deprecated v5.0.1 namespace of the concepts and of the value wrapper templates.
Primary namespace for the µTest++ testing framework.
C++ header file with declarations for the µTest++ reflection utilities.
C++ header file with declarations for the µTest++ test runner.
C++ header file with declarations for the µTest++ stopwatch.
Struct template representing a generic floating-point constant with custom size and precision.
Definition deprecated.h:556
constexpr T get(void) const noexcept
Getter for the compile-time constant value.
static constexpr auto value
The compile-time constant value.
Definition deprecated.h:585
static constexpr auto epsilon
The epsilon value used for floating-point comparisons.
Definition deprecated.h:576
Struct template representing a generic integral constant.
Definition deprecated.h:431
constexpr integral_constant(void) noexcept
Default constructor.
static constexpr auto value
The compile-time constant value.
Definition deprecated.h:438
constexpr auto operator-() const noexcept
Unary minus operator.
Struct template representing the absolute value of the minimum of a signed integral type,...
Definition deprecated.h:483
The result of parsing the characters of an integer literal.
Definition deprecated.h:258
unsigned long long value
The value of the literal.
Definition deprecated.h:265
bool is_too_large
Whether the value exceeds unsigned long long.
Definition deprecated.h:282
bool is_integer
Whether the characters form an integer literal.
Definition deprecated.h:274
constexpr std::string_view name(void) const noexcept
Returns the name of the constant.
std::string_view name_
The name of the constant.
Definition deprecated.h:787
constexpr named_bool(std::string_view name) noexcept
Constructs a named boolean constant with the given name.
Empty base struct for the framework expression types.
Definition extension.h:120
constexpr value(const T &_value, const T precision) noexcept
Constructs a floating-point value with a specified precision.
Definition deprecated.h:695
constexpr value(const T &val)
Constructs a floating-point value with default precision.
Definition deprecated.h:712
T epsilon
The epsilon value used for floating-point comparisons.
Definition deprecated.h:674
Base struct template providing common storage and accessors for run-time value-wrapper types.
Definition deprecated.h:352
op op_type
Marker identifying the framework expression types.
Definition deprecated.h:360
constexpr const T & get(void) const noexcept
Getter for the stored value.
T value_type
The type of the stored value.
Definition deprecated.h:368
constexpr value_base(const T &v) noexcept
Constructs a value_base with the given value.
Struct template representing a generic value, accessible via a getter.
Definition deprecated.h:629
constexpr value(const T &_value) noexcept
Constructs a value object with the specified value.
Deprecated generic strongly-typed wrapper for explicit type conversion.
constexpr to_t(const T &t)
Constructor for the strongly-typed wrapper.
static constexpr auto epsilon
The epsilon value used for floating-point comparisons.
Definition deprecated.h:576
Deprecated traits of the callable objects.
constexpr integral_constant(void) noexcept
Default constructor.
Struct template representing a generic value, accessible via a getter.
Definition deprecated.h:629
constexpr value(const T &_value) noexcept
Constructs a value object with the specified value.
C++ header file with declarations for the µTest++ test hierarchy.