micro-test-plus 6.0.0
µTest++ Testing Framework
Loading...
Searching...
No Matches
Deprecated

Definitions kept for compatibility with earlier releases. More...

Topics

 Operators
 Deprecated overloaded operators for test comparisons.
 Old logical function names
 Deprecated v5.0.1 names of the logical functions.
 Literals and wrappers
 Deprecated literal operators and wrappers for typed operands.

Namespaces

namespace  micro_os_plus::micro_test_plus::type_traits
 Deprecated v5.0.1 namespace of the concepts and of the value wrapper templates.

Concepts

concept  micro_os_plus::micro_test_plus::extension::has_epsilon
 Deprecated concept satisfied when T is a framework floating-point wrapper with a tolerance.
concept  micro_os_plus::micro_test_plus::type_traits::has_npos
 Deprecated concept satisfied when T provides a npos member.
concept  micro_os_plus::micro_test_plus::type_traits::has_value
 Deprecated concept satisfied when T has a member named value.
concept  micro_os_plus::micro_test_plus::type_traits::is_floating_point
 Deprecated concept satisfied when T is a floating-point type.

Classes

struct  micro_os_plus::micro_test_plus::type_traits::function_traits< T >
 Deprecated traits of the callable objects. More...
struct  micro_os_plus::micro_test_plus::type_traits::function_traits< R(*)(Args_T...)>
 Deprecated traits of the function pointers. More...
struct  micro_os_plus::micro_test_plus::type_traits::function_traits< R(Args_T...)>
 Deprecated traits of the function types. More...
struct  micro_os_plus::micro_test_plus::type_traits::function_traits< R(T::*)(Args_T...) const >
 Deprecated traits of the pointers to const member functions. More...
struct  micro_os_plus::micro_test_plus::type_traits::function_traits< R(T::*)(Args_T...)>
 Deprecated traits of the pointers to member functions. More...
struct  micro_os_plus::micro_test_plus::type_traits::identity< T, Extra >
 Deprecated identity type. More...
struct  micro_os_plus::micro_test_plus::type_traits::list< Types >
 Deprecated empty type list. More...
class  micro_os_plus::micro_test_plus::detail::timestamp
 Deprecated clock reading. More...

Typedefs

template<class T>
using micro_os_plus::micro_test_plus::type_traits::genuine_integral_value = detail::value<T>
 Deprecated integral value wrapper.
using micro_os_plus::micro_test_plus::detail::runner_totals = counters
 Deprecated name of counters.
using micro_os_plus::micro_test_plus::static_runner = runner
 Deprecated name of runner.
using micro_os_plus::micro_test_plus::subtest = test_case
 Deprecated name of test_case.
using micro_os_plus::micro_test_plus::detail::timestamps = stopwatch
 Deprecated name of stopwatch.
template<class T>
using micro_os_plus::micro_test_plus::type_traits::value_base_ = detail::value_base<T>
 Deprecated name of detail::value_base.

Functions

const char * micro_os_plus::micro_test_plus::reflection::short_name (const char *name) noexcept
 Deprecated extraction of the file name from a path.
template<class Lhs_T, class Rhs_T>
requires (extension::has_epsilon<Lhs_T> or extension::has_epsilon<Rhs_T>)
constexpr bool micro_os_plus::micro_test_plus::detail::within_tolerance (const Lhs_T &lhs, const Rhs_T &rhs)
 Deprecated check whether two operands are equal within the tolerance of the floating-point wrappers.

Variables

static constexpr bool micro_os_plus::micro_test_plus::detail::equal_to::within_tolerance_result = true
 Deprecated result when the operands are within the tolerance.
static constexpr bool micro_os_plus::micro_test_plus::detail::greater::within_tolerance_result = false
 Deprecated result when the operands are within the tolerance.
static constexpr bool micro_os_plus::micro_test_plus::detail::greater_equal::within_tolerance_result = true
 Deprecated result when the operands are within the tolerance.
static constexpr bool micro_os_plus::micro_test_plus::detail::less::within_tolerance_result = false
 Deprecated result when the operands are within the tolerance.
static constexpr bool micro_os_plus::micro_test_plus::detail::less_equal::within_tolerance_result = true
 Deprecated result when the operands are within the tolerance.
static constexpr bool micro_os_plus::micro_test_plus::detail::not_equal_to::within_tolerance_result = false
 Deprecated result when the operands are within the tolerance.

Deprecated Functions

template<class T>
constexpr auto micro_os_plus::micro_test_plus::mut (const T &t) noexcept -> T &
 Deprecated generic mutator to remove const qualification from a reference.

Detailed Description

The deprecated definitions are kept so that the tests written for the earlier releases still compile; they will be removed in a future major release. The compiler reports each use, with a message that names the replacement and the version that deprecated it (most of them since 6.0.0).

Availability
The deprecated definitions exist only when the application defines the macro MICRO_OS_PLUS_MICRO_TEST_PLUS_DEPRECATED_ENABLED (see Configuration). Without it, the tests that still use them do not compile, which shows what remains to be migrated.
Migration
Build once with the macro defined and the deprecation warnings enabled, and rewrite each reported use as its message suggests. While migrating, the applications that build with -Werror can disable the warnings temporarily with -Wno-deprecated-declarations.
// Deprecated.
using namespace mt::operators;
using namespace mt::literals;
t.expect (compute_answer () == 42_i) << "answer is 42";
// Replacement.
t.expect (mt::eq (compute_answer (), 42)) << "answer is 42";
Primary namespace for the µTest++ testing framework.
Deprecated groups
Three groups of deprecated definitions have topics of their own:
  • the overloaded comparison and logical operators (see Operators), replaced by the function comparators and the logical functions;
  • the user-defined literals and the value wrappers (see Literals and wrappers), replaced by the plain values passed to the function comparators;
  • the logical functions _and(), _or(), and _not() (see Old logical function names), replaced by all_of(), any_of(), and negate().
Other deprecated definitions
  • the v5.0.1 names of the classes: static_runner (replaced by runner), subtest (replaced by test_case), detail::runner_totals (replaced by counters), and detail::timestamps and detail::timestamp, which are internal and not replaced;
  • runner (const char*), replaced by runner() followed by add_top_suite() (since 4.1.0);
  • runner::initialise (argc, argv, top_suite_name), replaced by initialise (argc, argv) followed by add_top_suite();
  • runner::exit_code(), replaced by runner::run_suites();
  • runner::suite(), replaced by runner::add_suite();
  • runner::suites_count(), replaced by added_suites_count() or total_suites_count();
  • runner::verbosity(), and runner::reporter() with its verbosity() member, replaced by runner::verbosity_level();
  • runner::timings() and suite::timings(), and the members of detail::stopwatch kept from the v5.0.1 timestamps, which are internal and not replaced;
  • the counters members successful_checks(), executed_subtests(), and was_successful(), replaced by passed_checks(), executed_test_cases(), and passed() (the deprecated mutators increment_successful_checks() and increment_executed_subtests() were removed, since the counters are updated only by the framework);
  • test_case::assume(), replaced by test_case::require();
  • the overloads of test_case::expect() and test_case::require() that accept an argument that is always true (a string literal or a function name), replaced by writing the condition;
  • the static_suite constructor whose callable takes a static_suite&, replaced by a callable taking a suite&;
  • mut(), replaced by const_cast<T&>;
  • runner::name(), which always returned "runner", not replaced: the names in the reports are those of the suites (see add_top_suite());
  • detail::expression_formatter::c_str() and empty(), replaced by str().c_str() and str().empty();
  • the members children_subtests_count(), current_subtest_index(), and own_index() of the test nodes, which are internal and not replaced;
  • extension::has_epsilon, the concept that detects the floating-point wrappers with a tolerance, to be removed with them;
  • reflection::short_name(), replaced by utility::extract_file_name();
  • the type_traits namespace, with the concepts and the value wrapper templates of v5.0.1, replaced by the extension namespace;
  • the traits of the type_traits namespace: function_traits and list, which are not replaced, and identity, replaced by std::type_identity.

Typedef Documentation

◆ genuine_integral_value

Template Parameters
TThe integral type of the stored value.

In v5.0.1, a separate wrapper with the same members as value<T>, never created by the framework; now value<T>, so the values are compared and reported in the same way.

Deprecated
the value wrappers are internal (since 6.0.0)

Definition at line 2823 of file deprecated.h.

◆ runner_totals

The v5.0.1 name of the class returned by totals(), renamed since the suites and the test cases own one too, not only the runner.

Deprecated
use counters (since 6.0.0)

◆ static_runner

The runner also runs the static_suite objects that refer to it, so a separate runner class is no longer needed.

Deprecated
use runner (since 6.0.0)

◆ subtest

The v5.0.1 name of the class passed to the test case bodies, kept for the functions and the lambdas that name it as the type of their first parameter (void f (mt::subtest& t)); the lambdas with an auto& parameter are not affected.

Deprecated
use test_case (since 6.0.0)

◆ timestamps

The v5.0.1 name of the class returned by the timings() functions of the runner and of the suites, which kept the two timestamps of the measured interval. Its public members are kept, on stopwatch; its protected members, the two optional timestamp objects, are not. The timings are internal; the elapsed times are shown by the reporters.

Deprecated
the timings are internal (since 6.0.0)

◆ value_base_

Template Parameters
TThe type of the stored value.

The v5.0.1 name, with a trailing underscore. The stored value is now private, and get() returns a reference; the value is read with get() or with the explicit conversion, not through the v5.0.1 public member value_.

Deprecated
the value wrappers are internal (since 6.0.0)

Definition at line 2807 of file deprecated.h.

Function Documentation

◆ mut()

template<class T>
auto micro_os_plus::micro_test_plus::mut ( const T & t) -> T &
nodiscardconstexprnoexcept

Not used by the framework. Equivalent to const_cast<T&> (t), which replaces it.

Warning
Modifying an object that was originally declared as const through the returned reference is undefined behaviour.
Template Parameters
TThe type of the input object.
Parameters
tThe object from which to remove const qualification.
Returns
A non-const reference to the input object.
Deprecated
use const_cast<T&> (since 6.0.0)

Removes the const qualifier from the reference with const_cast.

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

726 {
727 return const_cast<T&> (t);
728 }

References mut().

Referenced by mut().

◆ short_name()

const char * micro_os_plus::micro_test_plus::reflection::short_name ( const char * name)
nodiscardnoexcept

Forwards to utility::extract_file_name(), which the framework uses internally; it is kept only for compatibility with the existing applications.

Parameters
nameThe path, as a C-string.
Returns
A pointer to the file name within the input string, after the last / or backslash separator, or the string itself if there is no separator.
Deprecated
use utility::extract_file_name() (since 6.0.0)

Delegates to utility::extract_file_name(), the single implementation used by the framework, so both the / and the backslash separators are recognised. If no separator is present, the original input string is returned.

Definition at line 78 of file deprecated.cpp.

79 {
80 return utility::extract_file_name (name);
81 }
const char * extract_file_name(const char *path) noexcept
Extracts the file name component from a full path.
Definition utility.cpp:95

References micro_os_plus::micro_test_plus::utility::extract_file_name(), and short_name().

Referenced by short_name().

◆ within_tolerance()

template<class Lhs_T, class Rhs_T>
requires (extension::has_epsilon<Lhs_T> or extension::has_epsilon<Rhs_T>)
bool micro_os_plus::micro_test_plus::detail::within_tolerance ( const Lhs_T & lhs,
const Rhs_T & rhs )
nodiscardconstexpr

Used by compare_op for all six tags, so that a value within the tolerance is equal, and neither less nor greater; at least one operand must have an epsilon member (a floating-point literal, a to_f, to_d, or to_ld wrapper, or approx()).

Used only by the deprecated floating-point wrappers, it is available only when MICRO_OS_PLUS_MICRO_TEST_PLUS_DEPRECATED_ENABLED is defined.

Deprecated
to be removed with the deprecated floating-point wrappers (since 6.0.0)
Template Parameters
Lhs_TThe type of the left-hand operand.
Rhs_TThe type of the right-hand operand.
Parameters
lhsThe left-hand operand.
rhsThe right-hand operand.
Return values
trueThe absolute difference is less than the tolerance (the smaller one, if both operands have one).
falseOtherwise.

The tolerance is the smaller epsilon of the two operands, if both have one, otherwise the epsilon of the operand that has one. The operands are equal when the absolute value of their difference is less than the tolerance.

Definition at line 212 of file detail-inlines.h.

213 {
214#if defined(__GNUC__)
215#pragma GCC diagnostic push
216#pragma GCC diagnostic ignored "-Wfloat-equal"
217#pragma GCC diagnostic ignored "-Wconversion"
218#pragma GCC diagnostic ignored "-Wdouble-promotion"
219#pragma GCC diagnostic ignored "-Wsign-compare"
220#if defined(__clang__)
221#pragma clang diagnostic ignored "-Wimplicit-int-float-conversion"
222#pragma clang diagnostic ignored "-Wpedantic"
223#endif // defined(__clang__)
224#endif // defined(__GNUC__)
225 const auto difference
226 = math::abs (detail::unwrap (lhs) - detail::unwrap (rhs));
229 {
230 // If both values have precision, use the smallest one.
231 return difference < math::min_value (lhs.epsilon, rhs.epsilon);
232 }
233 else if constexpr (extension::has_epsilon<Lhs_T>)
234 {
235 return difference < lhs.epsilon;
236 }
237 else
238 {
239 return difference < rhs.epsilon;
240 }
241#if defined(__GNUC__)
242#pragma GCC diagnostic pop
243#endif // defined(__GNUC__)
244 }
Deprecated concept satisfied when T is a framework floating-point wrapper with a tolerance.
Definition extension.h:349
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.
decltype(auto) constexpr unwrap(const T &t)
Returns the value wrapped by a framework type, or the operand itself.

References micro_os_plus::micro_test_plus::detail::math::abs(), micro_os_plus::micro_test_plus::detail::math::min_value(), unwrap(), and within_tolerance().

Referenced by micro_os_plus::micro_test_plus::detail::compare_op< Lhs_T, Rhs_T, Compare_T >::compare_op(), and within_tolerance().

Variable Documentation

◆ within_tolerance_result [1/6]

bool micro_os_plus::micro_test_plus::detail::equal_to::within_tolerance_result = true
staticconstexpr

Values within the tolerance are equal.

Used only by the tolerance of the deprecated floating-point wrappers.

Deprecated
to be removed with the deprecated floating-point wrappers (since 6.0.0)

Definition at line 468 of file detail.h.

◆ within_tolerance_result [2/6]

bool micro_os_plus::micro_test_plus::detail::greater::within_tolerance_result = false
staticconstexpr

Values within the tolerance are equal, not ordered.

Used only by the tolerance of the deprecated floating-point wrappers.

Deprecated
to be removed with the deprecated floating-point wrappers (since 6.0.0)

Definition at line 586 of file detail.h.

◆ within_tolerance_result [3/6]

bool micro_os_plus::micro_test_plus::detail::greater_equal::within_tolerance_result = true
staticconstexpr

Values within the tolerance are equal.

Used only by the tolerance of the deprecated floating-point wrappers.

Deprecated
to be removed with the deprecated floating-point wrappers (since 6.0.0)

Definition at line 645 of file detail.h.

◆ within_tolerance_result [4/6]

bool micro_os_plus::micro_test_plus::detail::less::within_tolerance_result = false
staticconstexpr

Values within the tolerance are equal, not ordered.

Used only by the tolerance of the deprecated floating-point wrappers.

Deprecated
to be removed with the deprecated floating-point wrappers (since 6.0.0)

Definition at line 704 of file detail.h.

◆ within_tolerance_result [5/6]

bool micro_os_plus::micro_test_plus::detail::less_equal::within_tolerance_result = true
staticconstexpr

Values within the tolerance are equal.

Used only by the tolerance of the deprecated floating-point wrappers.

Deprecated
to be removed with the deprecated floating-point wrappers (since 6.0.0)

Definition at line 763 of file detail.h.

◆ within_tolerance_result [6/6]

bool micro_os_plus::micro_test_plus::detail::not_equal_to::within_tolerance_result = false
staticconstexpr

Values within the tolerance are equal.

Used only by the tolerance of the deprecated floating-point wrappers.

Deprecated
to be removed with the deprecated floating-point wrappers (since 6.0.0)

Definition at line 527 of file detail.h.