Skip to main content

deprecated.h File

C++ header file with declarations for the deprecated µTest++ definitions. More...

Included Headers​

#include "counters.h" #include "extension.h" #include "function-comparators.h" #include "math.h" #include "reflection.h" #include "runner.h" #include "stopwatch.h" #include "test.h" #include <array> #include <concepts> #include <cstdint> #include <ctime> #include <limits> #include <string_view> #include <type_traits> #include "inlines/deprecated-inlines.h"

Namespaces Index​

namespacemicro_os_plus

The primary namespace for the µOS++ framework. More...

namespacemicro_test_plus

Primary namespace for the µTest++ testing framework. More...

namespacedetail

Internal implementation details for the µTest++ framework. More...

namespacemath

Internal mathematical utilities for the µTest++ testing framework. More...

namespaceliterals

Deprecated user-defined literals of the test checks. More...

namespaceoperators

Deprecated comparison and logical operators of the test checks. More...

namespacereflection

Reflection utilities for the µTest++ testing framework. More...

namespacetype_traits

Deprecated v5.0.1 namespace of the concepts and of the value wrapper templates. More...

Classes Index​

structfloating_point_constant<T, N, D, Size, P>

Struct template representing a generic floating-point constant with custom size and precision. More...

structfloating_point_constant<T, N, D, Size, P>

Struct template representing a generic floating-point constant with custom size and precision. More...

structfunction_traits<T>

Deprecated traits of the callable objects. More...

structfunction_traits<R(*)(Args_T...)>

Deprecated traits of the function pointers. More...

structfunction_traits<R(Args_T...)>

Deprecated traits of the function types. More...

structfunction_traits<R(T::*)(Args_T...) const>

Deprecated traits of the pointers to const member functions. More...

structfunction_traits<R(T::*)(Args_T...)>

Deprecated traits of the pointers to member functions. More...

structidentity<T, Extra>

Deprecated identity type. More...

structinteger_literal

The result of parsing the characters of an integer literal. More...

structintegral_constant<N>

Struct template representing a generic integral constant. More...

structintegral_constant<N>

Struct template representing a generic integral constant. More...

structintegral_min_magnitude<T>

Struct template representing the absolute value of the minimum of a signed integral type, as written in a literal. More...

structlist<Types>

Deprecated empty type list. More...

structnamed_bool

Struct representing a named boolean constant, created by the _b literal. More...

structop

Empty base struct for the framework expression types. More...

classtimestamp

Deprecated clock reading. More...

structto_t<T>

Deprecated generic strongly-typed wrapper for explicit type conversion. More...

structvalue<T>

Struct template representing a generic value, accessible via a getter. More...

structvalue<T>

Struct template representing a generic value, accessible via a getter. More...

structvalue<T>

Struct template representing a floating-point value with precision control. More...

structvalue_base<T>

Base struct template providing common storage and accessors for run-time value-wrapper types. More...

Concepts Index​

concepthas_npos

Deprecated concept satisfied when T provides a npos member. More...

concepthas_value

Deprecated concept satisfied when T has a member named value. More...

conceptis_floating_point

Deprecated concept satisfied when T is a floating-point type. More...

Typedefs Index​

template <class T>
usinggenuine_integral_value = detail::value< T >

Deprecated integral value wrapper. More...

usingrunner_totals = counters

Deprecated name of counters. More...

usingstatic_runner = runner

Deprecated name of runner. More...

usingsubtest = test_case

Deprecated name of test_case. More...

usingtimestamps = stopwatch

Deprecated name of stopwatch. More...

template <class T>
usingvalue_base_ = detail::value_base< T >

Deprecated name of detail::value_base. More...

Operators Index​

template <class Lhs_T, class Rhs_T>
constexpr autooperator and (Lhs_T &&lhs, Rhs_T &&rhs)

Deprecated logical && (and) operator. More...

template <class T>
constexpr autooperator not (T &&t)

Deprecated logical ! (not) operator. More...

template <class Lhs_T, class Rhs_T>
constexpr autooperator or (Lhs_T &&lhs, Rhs_T &&rhs)

Deprecated logical || (or) operator. More...

template <class Lhs_T, class Rhs_T>
constexpr autooperator!= (Lhs_T &&lhs, Rhs_T &&rhs)

Deprecated non-equality operator. More...

constexpr autooperator""_b (const char *name, decltype(sizeof("")) size)

Deprecated user-defined literal operator to create a named boolean constant. More...

template <char... Cs>
constexpr autooperator""_c ()

Deprecated user-defined literal operator to convert to char. More...

template <char... Cs>
constexpr autooperator""_d ()

Deprecated user-defined literal operator to convert to double. More...

template <char... Cs>
constexpr autooperator""_f ()

Deprecated user-defined literal operator to convert to float. More...

template <char... Cs>
constexpr autooperator""_i ()

Deprecated user-defined literal operator to convert to int. More...

template <char... Cs>
constexpr autooperator""_i16 ()

Deprecated user-defined literal operator to convert to int16_t. More...

template <char... Cs>
constexpr autooperator""_i32 ()

Deprecated user-defined literal operator to convert to int32_t. More...

template <char... Cs>
constexpr autooperator""_i64 ()

Deprecated user-defined literal operator to convert to int64_t. More...

template <char... Cs>
constexpr autooperator""_i8 ()

Deprecated user-defined literal operator to convert to int8_t. More...

template <char... Cs>
constexpr autooperator""_l ()

Deprecated user-defined literal operator to convert to long. More...

template <char... Cs>
constexpr autooperator""_ld ()

Deprecated user-defined literal operator to convert to long double. More...

template <char... Cs>
constexpr autooperator""_ll ()

Deprecated user-defined literal operator to convert to long long. More...

template <char... Cs>
constexpr autooperator""_s ()

Deprecated user-defined literal operator to convert to short. More...

template <char... Cs>
constexpr autooperator""_sc ()

Deprecated user-defined literal operator to convert to signed char. More...

template <char... Cs>
constexpr autooperator""_u ()

Deprecated user-defined literal operator to convert to unsigned. More...

template <char... Cs>
constexpr autooperator""_u16 ()

Deprecated user-defined literal operator to convert to uint16_t. More...

template <char... Cs>
constexpr autooperator""_u32 ()

Deprecated user-defined literal operator to convert to uint32_t. More...

template <char... Cs>
constexpr autooperator""_u64 ()

Deprecated user-defined literal operator to convert to uint64_t. More...

template <char... Cs>
constexpr autooperator""_u8 ()

Deprecated user-defined literal operator to convert to uint8_t. More...

template <char... Cs>
constexpr autooperator""_uc ()

Deprecated user-defined literal operator to convert to unsigned char. More...

template <char... Cs>
constexpr autooperator""_ul ()

Deprecated user-defined literal operator to convert to unsigned long. More...

template <char... Cs>
constexpr autooperator""_ull ()

Deprecated user-defined literal operator to convert to unsigned long long. More...

template <char... Cs>
constexpr autooperator""_us ()

Deprecated user-defined literal operator to convert to unsigned short. More...

template <class Lhs_T, class Rhs_T>
constexpr autooperator< (Lhs_T &&lhs, Rhs_T &&rhs)

Deprecated less than operator. More...

template <class Lhs_T, class Rhs_T>
constexpr autooperator<= (Lhs_T &&lhs, Rhs_T &&rhs)

Deprecated less than or equal operator. More...

template <class Lhs_T, class Rhs_T>
constexpr autooperator== (Lhs_T &&lhs, Rhs_T &&rhs)

Deprecated equality operator. More...

template <class Lhs_T, class Rhs_T>
constexpr autooperator> (Lhs_T &&lhs, Rhs_T &&rhs)

Deprecated greater than operator. More...

template <class Lhs_T, class Rhs_T>
constexpr autooperator>= (Lhs_T &&lhs, Rhs_T &&rhs)

Deprecated greater than or equal operator. More...

Functions Index​

template <class T, class Value_T>
constexpr Tcount_decimals (Value_T value)

Computes the number of decimal places of a value, with a precision of about seven digits. More...

template <bool Fraction, char... Cs>
std::size_tcount_literal_digits (void)

Counts the decimal digits of a floating-point literal, before or after the decimal point. More...

template <class Value_T>
constexpr Value_Tdecimal_epsilon (Value_T value)

Computes the default comparison tolerance of a floating-point value, one unit of its last decimal. More...

template <class T, char... Cs>
Tden (void)

Computes the decimal part of a number represented as an array of characters. More...

template <class T, char... Cs>
Tden_size (void)

Counts the decimal places of a number represented as an array of characters. More...

template <class T, char... Cs>
unsigned long longinteger_magnitude (void)

Computes the value of an integer literal of type T, before any negation. More...

template <class T, char... Cs>
constexpr autointegral_literal (void)

Creates the compile-time constant of an integer literal. More...

template <class T, char... Cs>
Tnum (void)

Computes the integral part of a decimal floating-point number represented as an array of characters. More...

template <char... Cs>
integer_literalparse_integer_literal (void)

Parses the characters of an integer literal. More...

template <class T, class Exp_T>
constexpr Tpow (const T base, const Exp_T exp) noexcept

Generic exponentiation function to compute the power of a base raised to an exponent. More...

const char *short_name (const char *name) noexcept

Deprecated extraction of the file name from a path. More...

Value Wrappers Index​

usingto_b = detail::value< bool >

Deprecated strongly-typed wrapper for bool values. More...

usingto_c = detail::value< char >

Deprecated strongly-typed wrapper for char values. More...

usingto_d = detail::value< double >

Deprecated strongly-typed wrapper for double values. More...

usingto_f = detail::value< float >

Deprecated strongly-typed wrapper for float values. More...

usingto_i = detail::value< int >

Deprecated strongly-typed wrapper for int values. More...

usingto_i16 = detail::value< std::int16_t >

Deprecated strongly-typed wrapper for std::int16_t values. More...

usingto_i32 = detail::value< std::int32_t >

Deprecated strongly-typed wrapper for std::int32_t values. More...

usingto_i64 = detail::value< std::int64_t >

Deprecated strongly-typed wrapper for std::int64_t values. More...

usingto_i8 = detail::value< std::int8_t >

Deprecated strongly-typed wrapper for std::int8_t values. More...

usingto_l = detail::value< long >

Deprecated strongly-typed wrapper for long values. More...

usingto_ld = detail::value< long double >

Deprecated strongly-typed wrapper for long double values. More...

usingto_ll = detail::value< long long >

Deprecated strongly-typed wrapper for long long values. More...

usingto_s = detail::value< short >

Deprecated strongly-typed wrapper for short values. More...

usingto_sc = detail::value< signed char >

Deprecated strongly-typed wrapper for signed char values. More...

usingto_u = detail::value< unsigned >

Deprecated strongly-typed wrapper for unsigned values. More...

usingto_u16 = detail::value< std::uint16_t >

Deprecated strongly-typed wrapper for std::uint16_t values. More...

usingto_u32 = detail::value< std::uint32_t >

Deprecated strongly-typed wrapper for std::uint32_t values. More...

usingto_u64 = detail::value< std::uint64_t >

Deprecated strongly-typed wrapper for std::uint64_t values. More...

usingto_u8 = detail::value< std::uint8_t >

Deprecated strongly-typed wrapper for std::uint8_t values. More...

usingto_uc = detail::value< unsigned char >

Deprecated strongly-typed wrapper for unsigned char values. More...

usingto_ul = detail::value< unsigned long >

Deprecated strongly-typed wrapper for unsigned long values. More...

usingto_ull = detail::value< unsigned long long >

Deprecated strongly-typed wrapper for unsigned long long values. More...

usingto_us = detail::value< unsigned short >

Deprecated strongly-typed wrapper for unsigned short values. More...

Deprecated Value Wrappers Index​

using_b = to_b

Deprecated strongly-typed wrapper for bool values, the v5.0.1 name of to_b. More...

using_c = to_c

Deprecated strongly-typed wrapper for char values, the v5.0.1 name of to_c. More...

using_d = to_d

Deprecated strongly-typed wrapper for double values, the v5.0.1 name of to_d. More...

using_f = to_f

Deprecated strongly-typed wrapper for float values, the v5.0.1 name of to_f. More...

using_i = to_i

Deprecated strongly-typed wrapper for int values, the v5.0.1 name of to_i. More...

using_i16 = to_i16

Deprecated strongly-typed wrapper for std::int16_t values, the v5.0.1 name of to_i16. More...

using_i32 = to_i32

Deprecated strongly-typed wrapper for std::int32_t values, the v5.0.1 name of to_i32. More...

using_i64 = to_i64

Deprecated strongly-typed wrapper for std::int64_t values, the v5.0.1 name of to_i64. More...

using_i8 = to_i8

Deprecated strongly-typed wrapper for std::int8_t values, the v5.0.1 name of to_i8. More...

using_l = to_l

Deprecated strongly-typed wrapper for long values, the v5.0.1 name of to_l. More...

using_ld = to_ld

Deprecated strongly-typed wrapper for long double values, the v5.0.1 name of to_ld. More...

using_ll = to_ll

Deprecated strongly-typed wrapper for long long values, the v5.0.1 name of to_ll. More...

using_s = to_s

Deprecated strongly-typed wrapper for short values, the v5.0.1 name of to_s. More...

using_sc = to_sc

Deprecated strongly-typed wrapper for signed char values, the v5.0.1 name of to_sc. More...

template <class T>
using_t = to_t< T >

Deprecated generic strongly-typed wrapper, the v5.0.1 name of to_t. More...

using_u = to_u

Deprecated strongly-typed wrapper for unsigned values, the v5.0.1 name of to_u. More...

using_u16 = to_u16

Deprecated strongly-typed wrapper for std::uint16_t values, the v5.0.1 name of to_u16. More...

using_u32 = to_u32

Deprecated strongly-typed wrapper for std::uint32_t values, the v5.0.1 name of to_u32. More...

using_u64 = to_u64

Deprecated strongly-typed wrapper for std::uint64_t values, the v5.0.1 name of to_u64. More...

using_u8 = to_u8

Deprecated strongly-typed wrapper for std::uint8_t values, the v5.0.1 name of to_u8. More...

using_uc = to_uc

Deprecated strongly-typed wrapper for unsigned char values, the v5.0.1 name of to_uc. More...

using_ul = to_ul

Deprecated strongly-typed wrapper for unsigned long values, the v5.0.1 name of to_ul. More...

using_ull = to_ull

Deprecated strongly-typed wrapper for unsigned long long values, the v5.0.1 name of to_ull. More...

using_us = to_us

Deprecated strongly-typed wrapper for unsigned short values, the v5.0.1 name of to_us. More...

Deprecated Functions Index​

template <class Lhs_T, class Rhs_T>
constexpr auto_and (Lhs_T &&lhs, Rhs_T &&rhs)

Deprecated generic logical and operation, the v5.0.1 name of all_of(). More...

template <class Expr_T>
constexpr auto_not (Expr_T &&expr)

Deprecated generic logical not operation, the v5.0.1 name of negate(). More...

template <class Lhs_T, class Rhs_T>
constexpr auto_or (Lhs_T &&lhs, Rhs_T &&rhs)

Deprecated generic logical (inclusive) or operation, the v5.0.1 name of any_of(). More...

template <class T>
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. More...

template <class T>
constexpr T &mut (const T &t) noexcept

Deprecated generic mutator to remove const qualification from a reference. More...

Description​

C++ header file with declarations for the deprecated µTest++ definitions.

This header groups the deprecated definitions that are not members of the framework classes, kept for compatibility with the applications written for the previous versions:

  • the v5.0.1 names of the logical functions (_not, _and, and _or);
  • the mut() helper, not used by the framework;
  • the overloaded operators of the operators namespace, the user-defined literals of the literals namespace, the to_* type wrappers, to_t<T>, and approx (value, epsilon), deprecated since 6.0.0 in favour of the function comparators;
  • the v5.0.1 names of the value wrappers (_i, _u8, etc.);
  • the v5.0.1 names of the classes (subtest, static_runner, detail::runner_totals, and detail::timestamps);
  • the detail::timestamp class;
  • the reflection::short_name() function;
  • the v5.0.1 type_traits namespace.

The deprecated member functions and data members remain in the declarations of their classes, since C++ does not allow them to be declared elsewhere.

All the deprecated definitions, in this header and in the classes, are available only when MICRO_OS_PLUS_MICRO_TEST_PLUS_DEPRECATED_ENABLED is defined; without it, the applications that still use them fail to compile.

Keeping the deprecated definitions separate makes them easy to identify and, in a future major release, to remove.

All definitions reside within the micro_os_plus::micro_test_plus namespace.

This file is included by micro-os-plus/micro-test-plus.h, which is the header that the applications include.

Functions​

count_decimals()​

template <class T, class Value_T>
T micro_os_plus::micro_test_plus::detail::math::count_decimals (Value_T value)
nodiscard constexpr

Computes the number of decimal places of a value, with a precision of about seven digits.

Template Parameters
T

The integral type for the result.

Value_T

The type of the input value, a floating-point type.

Parameters
value

The value whose decimal precision is to be determined; it may be negative, infinite, or a NaN.

Returns

The number of decimal places, as a value of type T, at least one, or zero for a zero value; the leading zeros of a value below one are counted; it is limited by the magnitude from which Value_T represents only integers.

This function template determines the number of decimal (fractional) digits present in a floating-point value, with a precision of about seven digits. Being constexpr, it can also be evaluated at compile time.

The function repeatedly multiplies the absolute value by ten, incrementing a counter until the distance to the nearest integer is at most a defined precision threshold (1e-7). Using the distance to the nearest integer, not the fractional part, prevents the rounding noise of a value just below an integer (e.g. 2674.9999999999995) from being taken as more decimals.

The nearest integer is never zero: while the scaled value is below one, its distance to one is used, so that the leading zeros of a small value are counted as decimals, as in its notation (12 for 1e-12), instead of the count stopping as soon as the scaled value is below the threshold. A zero value has no significant digit, and the result is zero.

The loop also stops when the value reaches the magnitude from which the type can represent only integers (2^23 for float, 2^52 for double), limited to 2^63 so that the conversion to unsigned long long is always defined. This bounds the number of steps for large values, infinities, and NaNs, for which the result is one; for small values, the number of steps is bounded by the decimal exponent of the smallest value of the type.

Definition at line 258 of file deprecated-inlines.h.

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 }

References micro_os_plus::micro_test_plus::detail::math::abs, micro_os_plus::micro_test_plus::detail::math::count_decimals and micro_os_plus::micro_test_plus::detail::math::min_value.

Referenced by micro_os_plus::micro_test_plus::detail::math::count_decimals and micro_os_plus::micro_test_plus::detail::math::decimal_epsilon.

count_literal_digits()​

template <bool Fraction, char... Cs>
std::size_t micro_os_plus::micro_test_plus::detail::math::count_literal_digits (void)
nodiscard

Counts the decimal digits of a floating-point literal, before or after the decimal point.

The digit separators (') are not counted.

Template Parameters
Fraction

true to count the digits after the decimal point, false to count those before it.

Cs

The characters of the literal.

Parameters

None.

Returns

The number of digits.

Walks the characters once, counting the decimal digits before the first decimal point (Fraction false) or after it (Fraction true); the digit separators are skipped.

Definition at line 101 of file deprecated-inlines.h.

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 }

Reference micro_os_plus::micro_test_plus::detail::math::count_literal_digits.

Referenced by micro_os_plus::micro_test_plus::detail::math::count_literal_digits, micro_os_plus::micro_test_plus::detail::math::den, micro_os_plus::micro_test_plus::detail::math::den_size and micro_os_plus::micro_test_plus::detail::math::num.

decimal_epsilon()​

template <class Value_T>
Value_T micro_os_plus::micro_test_plus::detail::math::decimal_epsilon (Value_T value)
nodiscard constexpr

Computes the default comparison tolerance of a floating-point value, one unit of its last decimal.

Template Parameters
Value_T

The type of the value, a floating-point type.

Parameters
value

The value whose tolerance is to be determined; it may be negative, infinite, or a NaN.

Returns

Ten raised to minus the number of decimal places returned by count_decimals() (0.01 for 1.25, 1e-12 for 1e-12), or zero, which means an exact comparison, for a zero value and for a value whose tolerance would be below the range of Value_T.

The number of decimal places is computed by count_decimals(), and the tolerance is one divided by ten raised to that number, as for the floating-point literals, which use the decimals written.

A zero value has no decimals, and gets a zero tolerance, so that it is compared exactly; a tolerance of one unit of an arbitrary decimal would make the zero equal to unrelated small values. A zero tolerance is also returned when ten raised to the number of decimals would exceed the range of Value_T (values below about 1e-308 for double), instead of computing an infinite power.

Definition at line 326 of file deprecated-inlines.h.

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 }

References micro_os_plus::micro_test_plus::detail::math::count_decimals, micro_os_plus::micro_test_plus::detail::math::decimal_epsilon and micro_os_plus::micro_test_plus::detail::math::pow.

Referenced by micro_os_plus::micro_test_plus::detail::math::decimal_epsilon.

den()​

template <class T, char... Cs>
T micro_os_plus::micro_test_plus::detail::math::den (void)
nodiscard

Computes the decimal part of a number represented as an array of characters.

Template Parameters
T

The target integral type for the result.

Cs

The character pack representing the numeric value; it must contain a decimal point.

Parameters

None.

Returns

The digits after the decimal point, as an integral value of type T (e.g. 25 for 1.25), to be divided by ten raised to the power returned by den_size().

This function template performs compile-time extraction of the decimal (fractional) part from a sequence of characters, typically provided as a template parameter pack.

The function expects the character sequence to represent a numeric value, where all characters are either digits, a dot (.), or an apostrophe ('). Parsing begins after the first dot, accumulating the decimal digits as an integer value and skipping the digit separators (e.g. 1.25 yields 25), so that den() / 10^den_size() gives the fraction. If the result could exceed T, the compilation fails with an explicit message.

Definition at line 177 of file deprecated-inlines.h.

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 }

References micro_os_plus::micro_test_plus::detail::math::count_literal_digits and micro_os_plus::micro_test_plus::detail::math::den.

Referenced by micro_os_plus::micro_test_plus::detail::math::den, micro_os_plus::micro_test_plus::literals::operator""_d, micro_os_plus::micro_test_plus::literals::operator""_f and micro_os_plus::micro_test_plus::literals::operator""_ld.

den_size()​

template <class T, char... Cs>
T micro_os_plus::micro_test_plus::detail::math::den_size (void)
nodiscard

Counts the decimal places of a number represented as an array of characters.

Template Parameters
T

The integral type for the result.

Cs

The character pack representing the numeric value; it must contain a decimal point.

Parameters

None.

Returns

The number of decimal places (e.g. 2 for 1.25), as a value of type T; it is the scale of the value returned by den().

This function template determines, at compile time, the number of decimal (fractional) digits present in a numeric value represented by a character sequence, typically provided as a template parameter pack.

The function expects the character sequence to represent a numeric value, where all characters are either digits, a dot (.), or an apostrophe ('). It returns the number of digits that follow the first dot (the digit separators are not counted; e.g. 2 for 1.25), which is the scale of the value returned by den().

Definition at line 220 of file deprecated-inlines.h.

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 }

References micro_os_plus::micro_test_plus::detail::math::count_literal_digits and micro_os_plus::micro_test_plus::detail::math::den_size.

Referenced by micro_os_plus::micro_test_plus::detail::math::den_size, micro_os_plus::micro_test_plus::literals::operator""_d, micro_os_plus::micro_test_plus::literals::operator""_f and micro_os_plus::micro_test_plus::literals::operator""_ld.

integer_magnitude()​

template <class T, char... Cs>
unsigned long long micro_os_plus::micro_test_plus::detail::math::integer_magnitude (void)
nodiscard

Computes the value of an integer literal of type T, before any negation.

Template Parameters
T

The integral type of the literal.

Cs

The characters of the literal, as received by a literal operator template.

Parameters

None.

Returns

The value of the literal, up to max() of T, or, for the signed types, up to max () + 1, the absolute value of the minimum.

The literal must be an integer literal, in any of the C++ forms (decimal, hexadecimal, binary, or octal, with digit separators), and its value must fit in T; otherwise the compilation fails with an explicit message.

Negative values are obtained with the unary minus, so the literal itself is never negative. For the signed types, the limit is the absolute value of the minimum, max () + 1, so that the minimum can be written (e.g. -128_i8); the caller allows this magnitude only when it is negated.

When a check fails, zero is returned, so that the callers report no further errors.

Definition at line 448 of file deprecated-inlines.h.

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 }

References micro_os_plus::micro_test_plus::detail::math::integer_magnitude, micro_os_plus::micro_test_plus::detail::math::integer_literal::is_integer, micro_os_plus::micro_test_plus::detail::math::integer_literal::is_too_large, micro_os_plus::micro_test_plus::detail::math::parse_integer_literal and micro_os_plus::micro_test_plus::detail::math::integer_literal::value.

Referenced by micro_os_plus::micro_test_plus::detail::math::integer_magnitude and micro_os_plus::micro_test_plus::detail::integral_literal.

integral_literal()​

template <class T, char... Cs>
auto micro_os_plus::micro_test_plus::detail::integral_literal (void)
nodiscard constexpr

Creates the compile-time constant of an integer literal.

Template Parameters
T

The integral type of the literal.

Cs

The characters of the literal, as received by a literal operator template.

Used by the integer literal operators (_i, _u8, etc.).

Parameters

None.

Returns

An integral_constant with the value of the literal, or, when the value is the absolute value of the minimum of a signed T, an integral_min_magnitude<T>, valid only when negated.

The value is checked by math::integer_magnitude(), which accepts, for the signed types, the absolute value of the minimum; this value does not fit in T, so it is represented by integral_min_magnitude<T>.

Definition at line 581 of file deprecated-inlines.h.

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 }

References micro_os_plus::micro_test_plus::detail::integral_constant< N >::integral_constant, micro_os_plus::micro_test_plus::detail::math::integer_magnitude and micro_os_plus::micro_test_plus::detail::integral_literal.

Referenced by micro_os_plus::micro_test_plus::detail::integral_literal, micro_os_plus::micro_test_plus::literals::operator""_c, micro_os_plus::micro_test_plus::literals::operator""_i, micro_os_plus::micro_test_plus::literals::operator""_i16, micro_os_plus::micro_test_plus::literals::operator""_i32, micro_os_plus::micro_test_plus::literals::operator""_i64, micro_os_plus::micro_test_plus::literals::operator""_i8, micro_os_plus::micro_test_plus::literals::operator""_l, micro_os_plus::micro_test_plus::literals::operator""_ll, micro_os_plus::micro_test_plus::literals::operator""_s, micro_os_plus::micro_test_plus::literals::operator""_sc, micro_os_plus::micro_test_plus::literals::operator""_u, micro_os_plus::micro_test_plus::literals::operator""_u16, micro_os_plus::micro_test_plus::literals::operator""_u32, micro_os_plus::micro_test_plus::literals::operator""_u64, micro_os_plus::micro_test_plus::literals::operator""_u8, micro_os_plus::micro_test_plus::literals::operator""_uc, micro_os_plus::micro_test_plus::literals::operator""_ul, micro_os_plus::micro_test_plus::literals::operator""_ull and micro_os_plus::micro_test_plus::literals::operator""_us.

num()​

template <class T, char... Cs>
T micro_os_plus::micro_test_plus::detail::math::num (void)
nodiscard

Computes the integral part of a decimal floating-point number represented as an array of characters.

Used by the floating-point literal operators; the integer literals use integer_magnitude(), which also accepts the C++ prefixes and checks the range.

Template Parameters
T

The target integral type for the result.

Cs

The character pack representing the numeric value.

Parameters

None.

Returns

The parsed integral value of type T.

This function template performs compile-time parsing of a numeric value from a sequence of characters, typically provided as a template parameter pack.

The characters must be decimal digits, a dot (.), or digit separators ('), which are skipped; otherwise (e.g. an exponent) the compilation fails with an explicit message, as it does if the integral part has more digits than T can always hold. Parsing stops at the first dot, allowing the function to extract only the integral part of the number.

Definition at line 134 of file deprecated-inlines.h.

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 }

References micro_os_plus::micro_test_plus::detail::math::count_literal_digits and micro_os_plus::micro_test_plus::detail::math::num.

Referenced by micro_os_plus::micro_test_plus::detail::math::num, micro_os_plus::micro_test_plus::literals::operator""_d, micro_os_plus::micro_test_plus::literals::operator""_f and micro_os_plus::micro_test_plus::literals::operator""_ld.

parse_integer_literal()​

template <char... Cs>
integer_literal micro_os_plus::micro_test_plus::detail::math::parse_integer_literal (void)
nodiscard

Parses the characters of an integer literal.

Template Parameters
Cs

The characters of the literal, as received by a literal operator template.

Parameters

None.

Returns

The value, and whether the characters form an integer literal and whether its value fits in unsigned long long.

The characters are those of a valid C++ literal, already checked by the compiler (digits valid for the base, digit separators in valid positions). The base is given by the prefix: 0x or 0X for hexadecimal, 0b or 0B for binary, a leading 0 for octal, and none for decimal. The digit separators (') are skipped.

Any other character (a decimal point, an exponent, or a digit not valid for the base, as in the floating-point literal 09.5) marks the literal as not an integer. The value is accumulated in unsigned long long, and the accumulation stops if it would overflow.

Definition at line 354 of file deprecated-inlines.h.

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;
375 }
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 }

Reference micro_os_plus::micro_test_plus::detail::math::parse_integer_literal.

Referenced by micro_os_plus::micro_test_plus::detail::math::integer_magnitude and micro_os_plus::micro_test_plus::detail::math::parse_integer_literal.

pow()​

template <class T, class Exp_T>
T micro_os_plus::micro_test_plus::detail::math::pow (const T base, const Exp_T exp)
nodiscard constexpr noexcept

Generic exponentiation function to compute the power of a base raised to an exponent.

Template Parameters
T

The type of the base value. Must support multiplication assignment and construction from an integer.

Exp_T

The type of the exponent. Must be default-constructible (to zero), and support the < and prefix ++ operators.

Parameters
base

The base value to be raised to the power of exp.

exp

The exponent value.

Returns

The result of raising base to the power of exp.

This function template provides a constexpr implementation for raising a base value to a given exponent, supporting any types that allow multiplication.

The function starts from one and multiplies the result by the base exp times. If the exponent is zero (or negative), the function returns one (the multiplicative identity for the type).

Definition at line 85 of file deprecated-inlines.h.

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 }

Reference micro_os_plus::micro_test_plus::detail::math::pow.

Referenced by micro_os_plus::micro_test_plus::detail::math::decimal_epsilon and micro_os_plus::micro_test_plus::detail::math::pow.

File Listing​

The file content with the documentation metadata removed is:

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:
408 T value_{};
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
1893 template <class T>
1894 struct [[deprecated (
1895 "pass plain values to eq() and the other comparators (since 6.0.0)")]]
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
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
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
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
2602 template <class T>
2603 concept has_value = requires (const T& t) { t.value; };
2604
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
2654 template <class T, class... Extra>
2655 struct identity
2656 {
2663 using type = T;
2664 };
2665
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
2704 template <class R, class... Args_T>
2705 struct function_traits<R (*) (Args_T...)>
2706 {
2713 using result_type = R;
2714
2722 using args = list<Args_T...>;
2723 };
2724
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
2772 template <class R, class T, class... Args_T>
2773 struct function_traits<R (T::*) (Args_T...)>
2774 {
2781 using result_type = R;
2782
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// ----------------------------------------------------------------------------

Generated via doxygen2docusaurus 2.2.8 by Doxygen 1.18.0.