micro-test-plus 6.0.0
µTest++ Testing Framework
Loading...
Searching...
No Matches
deprecated-inlines.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
41
42#ifndef MICRO_OS_PLUS_MICRO_TEST_PLUS_INLINES_DEPRECATED_INLINES_H_
43#define MICRO_OS_PLUS_MICRO_TEST_PLUS_INLINES_DEPRECATED_INLINES_H_
44
45// ----------------------------------------------------------------------------
46
47#if defined(__cplusplus)
48
49// ----------------------------------------------------------------------------
50
51#if defined(MICRO_OS_PLUS_MICRO_TEST_PLUS_DEPRECATED_ENABLED)
52
53#if defined(__GNUC__)
54#pragma GCC diagnostic push
55
56#pragma GCC diagnostic ignored "-Waggregate-return"
57#pragma GCC diagnostic ignored "-Wconversion"
58#if defined(__clang__)
59#pragma clang diagnostic ignored "-Wc++98-compat"
60#pragma clang diagnostic ignored "-Wc++98-compat-pedantic"
61#pragma clang diagnostic ignored "-Wpre-c++17-compat"
62#pragma clang diagnostic ignored "-Wc++20-compat"
63#endif // defined(__clang__)
64#endif // defined(__GNUC__)
65
66// ============================================================================
67
69{
70 // --------------------------------------------------------------------------
71 namespace detail::math
72 {
83 template <class T, class Exp_T>
84 constexpr auto
85 pow (const T base, const Exp_T exp) noexcept -> T
86 {
87 T result{ 1 };
88 for (Exp_T i{}; i < exp; ++i)
89 result *= base;
90 return result;
91 }
92
99 template <bool Fraction, char... Cs>
100 consteval auto
101 count_literal_digits (void) -> std::size_t
102 {
103 std::size_t count = 0;
104 bool is_fraction = false;
105 for (const char c : { Cs... })
106 {
107 if (c == '.')
108 {
109 is_fraction = true;
110 }
111 else if (c >= '0' and c <= '9' and is_fraction == Fraction)
112 {
113 ++count;
114 }
115 }
116 return count;
117 }
118
132 template <class T, char... Cs>
133 consteval auto
134 num (void) -> T
135 {
136 static_assert (
137 ((Cs == '.' or Cs == '\'' or (Cs >= '0' and Cs <= '9')) and ...),
138 "µTest++: a floating-point literal must be written with decimal "
139 "digits and a decimal point, without an exponent");
140 static_assert (
141 count_literal_digits<false, Cs...> ()
142 <= static_cast<std::size_t> (std::numeric_limits<T>::digits10),
143 "µTest++: the floating-point literal has too many "
144 "digits before the decimal point");
145 T result{};
146 for (const char c : { Cs... })
147 {
148 if (c == '.')
149 {
150 break;
151 }
152 if (c >= '0' and c <= '9')
153 {
154 result = static_cast<T> (result * static_cast<T> (10)
155 + static_cast<T> (c - '0'));
156 }
157 }
158 return result;
159 }
160
175 template <class T, char... Cs>
176 consteval auto
177 den (void) -> T
178 {
179 static_assert ((... || (Cs == '.')),
180 "den(): no decimal point in literal");
181 // The result has as many digits as the decimals, and it must fit in
182 // `T`.
183 static_assert (
184 count_literal_digits<true, Cs...> ()
185 <= static_cast<std::size_t> (std::numeric_limits<T>::digits10),
186 "µTest++: the floating-point literal has too many "
187 "decimals");
188 T result{};
189 bool is_fraction = false;
190 for (const char c : { Cs... })
191 {
192 if (c == '.')
193 {
194 is_fraction = true;
195 }
196 else if (is_fraction and c >= '0' and c <= '9')
197 {
198 // The digit separators are skipped.
199 result = static_cast<T> (result * static_cast<T> (10)
200 + static_cast<T> (c - '0'));
201 }
202 }
203 return result;
204 }
205
218 template <class T, char... Cs>
219 consteval auto
220 den_size (void) -> T
221 {
222 static_assert ((... || (Cs == '.')),
223 "den_size(): no decimal point in literal");
224 return static_cast<T> (count_literal_digits<true, Cs...> ());
225 }
226
256 template <class T, class Value_T>
257 constexpr auto
258 count_decimals (Value_T value) -> T
259 {
260 constexpr auto precision = Value_T (1e-7);
261 // From this magnitude upwards all values are integers.
262 constexpr auto integral_limit
263 = min_value (Value_T (1) / std::numeric_limits<Value_T>::epsilon (),
264 Value_T (1ULL << 63));
265
266 value = abs (value);
267
268#if defined(__GNUC__)
269#pragma GCC diagnostic push
270#pragma GCC diagnostic ignored "-Wfloat-equal"
271#endif // defined(__GNUC__)
272 if (value == Value_T (0))
273 {
274 // A zero has no decimals.
275 return T{};
276 }
277#if defined(__GNUC__)
278#pragma GCC diagnostic pop
279#endif // defined(__GNUC__)
280
281 T result{};
282 for (;;)
283 {
284 value *= 10;
285 ++result;
286
287 // Also true for infinities and NaNs.
288 if (not(value < integral_limit))
289 {
290 break;
291 }
292
293 const auto fraction = value
294 - static_cast<Value_T> (
295 static_cast<unsigned long long> (value));
296 // Below one, the distance is to one, not to zero, so that the
297 // leading zeros of a small value are counted.
298 const auto distance
299 = (value < Value_T (1))
300 ? Value_T (1) - fraction
301 : min_value (fraction, Value_T (1) - fraction);
302 if (distance <= precision)
303 {
304 break;
305 }
306 }
307
308 return result;
309 }
310
324 template <class Value_T>
325 constexpr auto
326 decimal_epsilon (Value_T value) -> Value_T
327 {
328 const auto decimals = count_decimals<unsigned long long> (value);
329 if (decimals == 0
330 or decimals > static_cast<unsigned long long> (
331 std::numeric_limits<Value_T>::max_exponent10))
332 {
333 return Value_T{};
334 }
335 return Value_T (1) / pow (Value_T (10), decimals);
336 }
337
352 template <char... Cs>
353 consteval auto
355 {
356 constexpr std::array<char, sizeof...(Cs)> cs{ Cs... };
357 constexpr unsigned long long max_value
358 = std::numeric_limits<unsigned long long>::max ();
359
360 integer_literal result{ 0, true, false };
361
362 unsigned long long base = 10;
363 std::size_t i = 0;
364 if (cs.size () > 1 && cs[0] == '0')
365 {
366 if (cs[1] == 'x' || cs[1] == 'X')
367 {
368 base = 16;
369 i = 2;
370 }
371 else if (cs[1] == 'b' || cs[1] == 'B')
372 {
373 base = 2;
374 i = 2;
376 else
377 {
378 base = 8;
379 i = 1;
380 }
381 }
382
383 for (; i < cs.size (); ++i)
384 {
385 const char c = cs[i];
386 if (c == '\'')
387 {
388 continue;
389 }
390
391 unsigned long long digit = 0;
392 if (c >= '0' && c <= '9')
393 {
394 digit = static_cast<unsigned long long> (c - '0');
395 }
396 else if (base == 16 && c >= 'a' && c <= 'f')
397 {
398 digit = static_cast<unsigned long long> (c - 'a' + 10);
399 }
400 else if (base == 16 && c >= 'A' && c <= 'F')
401 {
402 digit = static_cast<unsigned long long> (c - 'A' + 10);
403 }
404 else
405 {
406 // A decimal point, an exponent, or a suffix character.
407 result.is_integer = false;
408 return result;
409 }
410
411 if (digit >= base)
412 {
413 // Possible only in a floating-point literal, like `09.5`.
414 result.is_integer = false;
415 return result;
416 }
417
418 if (result.value > (max_value - digit) / base)
419 {
420 result.is_too_large = true;
421 return result;
422 }
423
424 result.value = result.value * base + digit;
425 }
426
427 return result;
428 }
429
446 template <class T, char... Cs>
447 consteval auto
448 integer_magnitude (void) -> unsigned long long
449 {
450 constexpr integer_literal literal = parse_integer_literal<Cs...> ();
451 constexpr unsigned long long max_magnitude
452 = static_cast<unsigned long long> (std::numeric_limits<T>::max ())
453 + (std::numeric_limits<T>::is_signed ? 1u : 0u);
454 constexpr bool fits = literal.is_integer && !literal.is_too_large
455 && literal.value <= max_magnitude;
456
457 static_assert (literal.is_integer,
458 "µTest++: an integer literal must not have a decimal "
459 "point or an exponent");
460 static_assert (!literal.is_integer || !literal.is_too_large,
461 "µTest++: the integer literal is too large");
462 static_assert (!literal.is_integer || literal.is_too_large || fits,
463 "µTest++: the integer literal value does not fit in the "
464 "type of the literal");
465
466 return fits ? literal.value : 0;
467 }
468
469 // ------------------------------------------------------------------------
470 // ------------------------------------------------------------------------
471 } // namespace detail::math
472
473 namespace detail
474 {
475 // ========================================================================
476
481 template <class T>
482 constexpr value_base<T>::value_base (const T& v) noexcept : value_{ v }
483 {
484 }
485
490 template <class T>
491 constexpr value_base<T>::
492 operator T () const noexcept
493 {
494 return value_;
495 }
496
502 template <class T>
503 constexpr const T&
504 value_base<T>::get (void) const noexcept
505 {
506 return value_;
507 }
508
509 // ------------------------------------------------------------------------
510
515 template <auto N>
517 : value_base<decltype (N)>{ N }
518 {
519 }
520
530 template <auto N>
531 constexpr auto
533 {
534 // Not named `value_type`, which would shadow the member inherited
535 // from the base (`-Wshadow`).
536 using constant_type = decltype (N);
537
538 if constexpr (!std::is_signed_v<constant_type>)
539 {
541 - N)>{};
542 }
543 else if constexpr (N == std::numeric_limits<constant_type>::min ())
544 {
545 static_assert (N != std::numeric_limits<constant_type>::min (),
546 "µTest++: the negation of the minimum value does "
547 "not fit in the type of the literal");
548 return *this;
549 }
550 else
551 {
553 }
554 }
555
556 // ------------------------------------------------------------------------
557
563 template <class T>
564 constexpr auto
569
570 // ------------------------------------------------------------------------
571
579 template <class T, char... Cs>
580 constexpr auto
582 {
583 constexpr unsigned long long magnitude
584 = math::integer_magnitude<T, Cs...> ();
585
586 if constexpr (magnitude > static_cast<unsigned long long> (
587 std::numeric_limits<T>::max ()))
588 {
590 }
591 else
592 {
593 return integral_constant<static_cast<T> (magnitude)>{};
594 }
595 }
596
597 // ------------------------------------------------------------------------
598
603 template <class T, auto N, auto D, auto Size, auto P>
605 operator T () const noexcept
606 {
607 return value;
608 }
609
614 template <class T, auto N, auto D, auto Size, auto P>
615 constexpr T
617 {
618 return value;
619 }
620
626 template <class T, auto N, auto D, auto Size, auto P>
627 constexpr auto
629 {
630 return floating_point_constant<T, N, D, Size, -P>{};
631 }
632
633 // ------------------------------------------------------------------------
634
635 template <class T>
636 constexpr value<T>::value (const T& _value) noexcept
637 : value_base<T>{ _value }
638 {
639 }
640
641 // ------------------------------------------------------------------------
642
647 constexpr named_bool::named_bool (std::string_view name) noexcept
648 : name_{ name }
649 {
650 }
651
656 constexpr named_bool::
657 operator value_type () const noexcept
658 {
659 return true;
660 }
661
666 constexpr std::string_view
667 named_bool::name (void) const noexcept
668 {
669 return name_;
670 }
671
672 // ------------------------------------------------------------------------
673 } // namespace detail
674
675 // --------------------------------------------------------------------------
676
682 // Deprecated since 6.0.0; use negate().
683 template <class Expr_T>
684 constexpr auto
685 _not (Expr_T&& expr)
686 {
687 return negate (std::forward<Expr_T> (expr));
688 }
689
695 // Deprecated since 6.0.0; use all_of().
696 template <class Lhs_T, class Rhs_T>
697 constexpr auto
698 _and (Lhs_T&& lhs, Rhs_T&& rhs)
699 {
700 return all_of (std::forward<Lhs_T> (lhs), std::forward<Rhs_T> (rhs));
701 }
702
708 // Deprecated since 6.0.0; use any_of().
709 template <class Lhs_T, class Rhs_T>
710 constexpr auto
711 _or (Lhs_T&& lhs, Rhs_T&& rhs)
712 {
713 return any_of (std::forward<Lhs_T> (lhs), std::forward<Rhs_T> (rhs));
714 }
715
716 // --------------------------------------------------------------------------
717
722 // Deprecated since 6.0.0; use const_cast<T&>.
723 template <class T>
724 constexpr auto
725 mut (const T& t) noexcept -> T&
726 {
727 return const_cast<T&> (t);
728 }
729
730 // --------------------------------------------------------------------------
731
732 namespace operators
733 {
734 // ========================================================================
735
743 template <class Lhs_T, class Rhs_T>
744 requires extension::any_op<std::remove_cvref_t<Lhs_T>,
745 std::remove_cvref_t<Rhs_T>>
746 constexpr auto
747 operator== (Lhs_T&& lhs, Rhs_T&& rhs)
748 {
749 return detail::compare_op{ std::forward<Lhs_T> (lhs),
750 std::forward<Rhs_T> (rhs),
752 }
753
761 template <class Lhs_T, class Rhs_T>
763 std::remove_cvref_t<Rhs_T>>
764 constexpr auto
765 operator!= (Lhs_T&& lhs, Rhs_T&& rhs)
766 {
767 return detail::compare_op{ std::forward<Lhs_T> (lhs),
768 std::forward<Rhs_T> (rhs),
770 }
771
779 template <class Lhs_T, class Rhs_T>
781 std::remove_cvref_t<Rhs_T>>
782 constexpr auto
783 operator> (Lhs_T&& lhs, Rhs_T&& rhs)
784 {
785 return detail::compare_op{ std::forward<Lhs_T> (lhs),
786 std::forward<Rhs_T> (rhs),
787 detail::greater{} };
788 }
789
797 template <class Lhs_T, class Rhs_T>
799 std::remove_cvref_t<Rhs_T>>
800 constexpr auto
801 operator>= (Lhs_T&& lhs, Rhs_T&& rhs)
802 {
803 return detail::compare_op{ std::forward<Lhs_T> (lhs),
804 std::forward<Rhs_T> (rhs),
806 }
807
815 template <class Lhs_T, class Rhs_T>
817 std::remove_cvref_t<Rhs_T>>
818 constexpr auto
819 operator< (Lhs_T&& lhs, Rhs_T&& rhs)
820 {
821 return detail::compare_op{ std::forward<Lhs_T> (lhs),
822 std::forward<Rhs_T> (rhs), detail::less{} };
823 }
824
832 template <class Lhs_T, class Rhs_T>
834 std::remove_cvref_t<Rhs_T>>
835 constexpr auto
836 operator<= (Lhs_T&& lhs, Rhs_T&& rhs)
837 {
838 return detail::compare_op{ std::forward<Lhs_T> (lhs),
839 std::forward<Rhs_T> (rhs),
841 }
842
850 template <class Lhs_T, class Rhs_T>
852 std::remove_cvref_t<Rhs_T>>
853 constexpr auto
854 operator and (Lhs_T&& lhs, Rhs_T&& rhs)
855 {
856 return detail::and_op{ std::forward<Lhs_T> (lhs),
857 std::forward<Rhs_T> (rhs) };
858 }
859
867 template <class Lhs_T, class Rhs_T>
869 std::remove_cvref_t<Rhs_T>>
870 constexpr auto
871 operator or (Lhs_T&& lhs, Rhs_T&& rhs)
872 {
873 return detail::or_op{ std::forward<Lhs_T> (lhs),
874 std::forward<Rhs_T> (rhs) };
875 }
876
883 template <class T>
885 constexpr auto
886 operator not(T&& t)
887 {
888 // Not `not_op{ t }`, which would copy an operand that is itself
889 // a `not_op`, instead of negating it.
890 return detail::not_op<detail::stored_operand_t<T>>{ std::forward<T> (
891 t) };
892 }
893
894 // ------------------------------------------------------------------------
895 } // namespace operators
896
897 // --------------------------------------------------------------------------
898
899 namespace literals
900 {
901
909 template <char... Cs>
910 constexpr auto
911 operator""_i ()
912 {
913 return detail::integral_literal<int, Cs...> ();
914 }
915
923 template <char... Cs>
924 constexpr auto
925 operator""_s ()
926 {
927 return detail::integral_literal<short, Cs...> ();
928 }
929
937 template <char... Cs>
938 constexpr auto
939 operator""_c ()
940 {
941 return detail::integral_literal<char, Cs...> ();
942 }
943
951 template <char... Cs>
952 constexpr auto
953 operator""_sc ()
954 {
955 return detail::integral_literal<signed char, Cs...> ();
956 }
957
965 template <char... Cs>
966 constexpr auto
967 operator""_l ()
968 {
969 return detail::integral_literal<long, Cs...> ();
970 }
971
979 template <char... Cs>
980 constexpr auto
981 operator""_ll ()
982 {
983 return detail::integral_literal<long long, Cs...> ();
984 }
985
993 template <char... Cs>
994 constexpr auto
995 operator""_u ()
996 {
997 return detail::integral_literal<unsigned, Cs...> ();
998 }
999
1007 template <char... Cs>
1008 constexpr auto
1009 operator""_uc ()
1010 {
1011 return detail::integral_literal<unsigned char, Cs...> ();
1012 }
1013
1021 template <char... Cs>
1022 constexpr auto
1023 operator""_us ()
1024 {
1025 return detail::integral_literal<unsigned short, Cs...> ();
1026 }
1027
1035 template <char... Cs>
1036 constexpr auto
1037 operator""_ul ()
1038 {
1039 return detail::integral_literal<unsigned long, Cs...> ();
1040 }
1041
1049 template <char... Cs>
1050 constexpr auto
1051 operator""_ull ()
1052 {
1053 return detail::integral_literal<unsigned long long, Cs...> ();
1054 }
1055
1063 template <char... Cs>
1064 constexpr auto
1065 operator""_i8 ()
1066 {
1067 return detail::integral_literal<std::int8_t, Cs...> ();
1068 }
1069
1077 template <char... Cs>
1078 constexpr auto
1079 operator""_i16 ()
1080 {
1081 return detail::integral_literal<std::int16_t, Cs...> ();
1082 }
1083
1091 template <char... Cs>
1092 constexpr auto
1093 operator""_i32 ()
1094 {
1095 return detail::integral_literal<std::int32_t, Cs...> ();
1096 }
1097
1105 template <char... Cs>
1106 constexpr auto
1107 operator""_i64 ()
1108 {
1109 return detail::integral_literal<std::int64_t, Cs...> ();
1110 }
1111
1119 template <char... Cs>
1120 constexpr auto
1121 operator""_u8 ()
1122 {
1123 return detail::integral_literal<std::uint8_t, Cs...> ();
1124 }
1125
1133 template <char... Cs>
1134 constexpr auto
1135 operator""_u16 ()
1136 {
1137 return detail::integral_literal<std::uint16_t, Cs...> ();
1138 }
1139
1147 template <char... Cs>
1148 constexpr auto
1149 operator""_u32 ()
1150 {
1151 return detail::integral_literal<std::uint32_t, Cs...> ();
1152 }
1153
1161 template <char... Cs>
1162 constexpr auto
1163 operator""_u64 ()
1164 {
1165 return detail::integral_literal<std::uint64_t, Cs...> ();
1166 }
1167
1176 template <char... Cs>
1177 constexpr auto
1178 operator""_f ()
1179 {
1181 float, detail::math::num<unsigned long long, Cs...> (),
1183 detail::math::den_size<unsigned long long, Cs...> ()>{};
1184 }
1185
1194 template <char... Cs>
1195 constexpr auto
1196 operator""_d ()
1197 {
1199 double, detail::math::num<unsigned long long, Cs...> (),
1201 detail::math::den_size<unsigned long long, Cs...> ()>{};
1202 }
1203
1212 template <char... Cs>
1213 constexpr auto
1214 operator""_ld ()
1215 {
1217 long double, detail::math::num<unsigned long long, Cs...> (),
1219 detail::math::den_size<unsigned long long, Cs...> ()>{};
1220 }
1221
1237 constexpr auto
1238 operator""_b (const char* name, decltype (sizeof ("")) size)
1239 {
1240 return detail::named_bool{ std::string_view{ name, size } };
1241 }
1242
1243 // ------------------------------------------------------------------------
1244 } // namespace literals
1245
1246 // ==========================================================================
1247
1248#if defined(__GNUC__)
1249#pragma GCC diagnostic push
1250// The definition of the deprecated class.
1251#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
1252#endif // defined(__GNUC__)
1253
1259 template <class T>
1260 constexpr to_t<T>::to_t (const T& t) : detail::value<T>{ t }
1261 {
1262 }
1263
1264#if defined(__GNUC__)
1265#pragma GCC diagnostic pop
1266#endif // defined(__GNUC__)
1267
1274 template <class T>
1275 requires std::is_floating_point_v<T>
1276 constexpr auto
1277 approx (T value, std::type_identity_t<T> epsilon) noexcept
1279 {
1280 return detail::value<T>{ value, epsilon };
1281 }
1282
1283} // namespace micro_os_plus::micro_test_plus
1284
1285// ============================================================================
1286
1288{
1289 // ==========================================================================
1290
1295 // Deprecated since 6.0.0, as the whole `timestamp` class; the timings are
1296 // internal.
1297 inline timestamp::timestamp (const timespec& ts) noexcept : value_{ ts }
1298 {
1299 }
1300
1306 // Deprecated since 6.0.0, as the whole `timestamp` class; the timings are
1307 // internal.
1308 inline bool
1309 timestamp::has_clock (void) const noexcept
1310 {
1311 return value_.tv_sec != 0 || value_.tv_nsec != 0;
1312 }
1313
1319 // Deprecated since 6.0.0, as the whole `timestamp` class; the timings are
1320 // internal.
1321 inline timespec&
1322 timestamp::value (void) noexcept
1323 {
1324 return value_;
1325 }
1326
1331 // Deprecated since 6.0.0, as the whole `timestamp` class; the timings are
1332 // internal.
1333 inline const timespec&
1334 timestamp::value (void) const noexcept
1335 {
1336 return value_;
1337 }
1338
1339 // --------------------------------------------------------------------------
1340} // namespace micro_os_plus::micro_test_plus::detail
1341
1342#if defined(__GNUC__)
1343#pragma GCC diagnostic pop
1344#endif // defined(__GNUC__)
1345
1346#endif // defined(MICRO_OS_PLUS_MICRO_TEST_PLUS_DEPRECATED_ENABLED)
1347
1348// ----------------------------------------------------------------------------
1349
1350#endif // defined(__cplusplus)
1351
1352// ----------------------------------------------------------------------------
1353
1354#endif // MICRO_OS_PLUS_MICRO_TEST_PLUS_INLINES_DEPRECATED_INLINES_H_
1355
1356// ----------------------------------------------------------------------------
timespec & value(void) noexcept
Returns the stored time, for modification.
timestamp(void) noexcept
Constructs a timestamp with the current time.
bool has_clock(void) const noexcept
Checks whether the value is a clock reading.
Concept satisfied when at least one of two types is a framework expression type.
Definition extension.h:369
Concept satisfied when a type is a framework expression type.
Definition extension.h:320
to_sc _sc
Deprecated strongly-typed wrapper for signed char values, the v5.0.1 name of to_sc.
to_u64 _u64
Deprecated strongly-typed wrapper for std::uint64_t values, the v5.0.1 name of to_u64.
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.
to_us _us
Deprecated strongly-typed wrapper for unsigned short values, the v5.0.1 name of to_us.
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.
to_i32 _i32
Deprecated strongly-typed wrapper for std::int32_t values, the v5.0.1 name of to_i32.
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.
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.
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.
to_u8 _u8
Deprecated strongly-typed wrapper for std::uint8_t values, the v5.0.1 name of to_u8.
to_c _c
Deprecated strongly-typed wrapper for char values, the v5.0.1 name of to_c.
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.
constexpr auto operator!=(Lhs_T &&lhs, Rhs_T &&rhs)
Deprecated non-equality operator.
constexpr auto operator<(Lhs_T &&lhs, Rhs_T &&rhs)
Deprecated less than operator.
constexpr auto operator==(Lhs_T &&lhs, Rhs_T &&rhs)
Deprecated equality operator.
constexpr auto operator>=(Lhs_T &&lhs, Rhs_T &&rhs)
Deprecated greater than or equal operator.
constexpr auto operator<=(Lhs_T &&lhs, Rhs_T &&rhs)
Deprecated less than or equal operator.
constexpr auto operator>(Lhs_T &&lhs, Rhs_T &&rhs)
Deprecated greater than operator.
constexpr auto all_of(First_T &&first, Second_T &&second, Rest_T &&... rest)
Generic logical and operation, for two or more operands.
constexpr auto any_of(First_T &&first, Second_T &&second, Rest_T &&... rest)
Generic logical (inclusive) or operation, for two or more operands.
constexpr auto negate(Expr_T &&expr)
Generic logical not operation.
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.
constexpr auto abs(const T t) noexcept -> T
Computes the absolute value of a given comparable value.
constexpr auto min_value(const T &lhs, const T &rhs) noexcept -> const T &
Computes the minimum of two comparable values.
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.
Primary namespace for the µTest++ testing framework.
Logical AND comparator struct template.
Definition detail.h:1083
Relational comparator struct template.
Definition detail.h:887
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
constexpr auto operator-() const noexcept
Unary minus operator.
Greater than or equal tag for compare_op.
Definition detail.h:619
Greater than tag for compare_op.
Definition detail.h:560
Struct template representing a generic integral constant.
Definition deprecated.h:431
constexpr integral_constant(void) noexcept
Default constructor.
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
constexpr auto operator-() const noexcept
Unary minus operator.
Less than or equal tag for compare_op.
Definition detail.h:737
Less than tag for compare_op.
Definition detail.h:678
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
Struct representing a named boolean constant, created by the _b literal.
Definition deprecated.h:744
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.
Non-equality tag for compare_op.
Definition detail.h:501
Logical NOT comparator struct template.
Definition detail.h:1195
Logical OR comparator struct template.
Definition detail.h:1138
constexpr value(const T &_value, const T precision) noexcept
Constructs a floating-point value with a specified precision.
Definition deprecated.h:695
Base struct template providing common storage and accessors for run-time value-wrapper types.
Definition deprecated.h:352
constexpr const T & get(void) const noexcept
Getter for the stored value.
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.
constexpr to_t(const T &t)
Constructor for the strongly-typed wrapper.