micro-test-plus 6.0.0
µTest++ Testing Framework
Loading...
Searching...
No Matches
micro_os_plus::micro_test_plus Namespace Reference

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

Namespaces

namespace  anonymous_namespace{runner.cpp}
 Local helpers of the runner.
namespace  detail
 Internal implementation details for the µTest++ framework.
namespace  extension
 The templates and the concepts for extending the µTest++ testing framework.
namespace  literals
 Deprecated user-defined literals of the test checks.
namespace  operators
 Deprecated comparison and logical operators of the test checks.
namespace  reflection
 Reflection utilities for the µTest++ testing framework.
namespace  type_traits
 Deprecated v5.0.1 namespace of the concepts and of the value wrapper templates.
namespace  utility
 Utility functions for the µTest++ testing framework.

Classes

class  counters
 Aggregated check and test case counters for a node in the test tree. More...
class  located_name
 A name of a suite or of a test case, with the location where it was given. More...
class  runner
 The test runner for the µTest++ framework. More...
class  runner_options
 The configuration of a test session, and its command-line parser. More...
class  static_suite
 A test suite designed for static (namespace-scope) registration with a runner. More...
class  suite
 A named, runnable test suite registered with the test runner. More...
class  test_case
 A named, runnable test case that lives inside a suite. More...
struct  to_t
 Deprecated generic strongly-typed wrapper for explicit type conversion. More...
class  top_suite
 The optional top suite owned by every runner instance. More...

Typedefs

using expression_formatter = detail::expression_formatter
 Public name of the formatter used to report operand values.
using static_runner = runner
 Deprecated name of runner.
using subtest = test_case
 Deprecated name of test_case.
Value Wrappers

Strongly-typed wrappers for converting dynamic values and expressions to specific types recognised by µTest++ comparators.

These type aliases provide a type-safe mechanism for explicitly converting values to the required types for µTest++ test expressions and comparators. Each alias is a wrapper around detail::value<T>, ensuring that the value is treated as the specified type within the framework.

The to_* forms replaced the older _i, _u8, etc. aliases, which were deprecated in version 3.2.0.

Deprecated
Pass the plain values to the function comparators eq(), ne(), gt(), ge(), lt(), and le() instead; they report the operands in the same way. For the floating-point values compared with a tolerance, use approx() (since 6.0.0).
Example
int x = 42;
// Explicitly treat x as an int for test comparison.
auto wrapped = mt::to_i{x};
Primary namespace for the µTest++ testing framework.
Since
3.2.0
using to_b = detail::value<bool>
 Deprecated strongly-typed wrapper for bool values.
using to_c = detail::value<char>
 Deprecated strongly-typed wrapper for char values.
using to_sc = detail::value<signed char>
 Deprecated strongly-typed wrapper for signed char values.
using to_s = detail::value<short>
 Deprecated strongly-typed wrapper for short values.
using to_i = detail::value<int>
 Deprecated strongly-typed wrapper for int values.
using to_l = detail::value<long>
 Deprecated strongly-typed wrapper for long values.
using to_ll = detail::value<long long>
 Deprecated strongly-typed wrapper for long long values.
using to_u = detail::value<unsigned>
 Deprecated strongly-typed wrapper for unsigned values.
using to_uc = detail::value<unsigned char>
 Deprecated strongly-typed wrapper for unsigned char values.
using to_us = detail::value<unsigned short>
 Deprecated strongly-typed wrapper for unsigned short values.
using to_ul = detail::value<unsigned long>
 Deprecated strongly-typed wrapper for unsigned long values.
using to_ull = detail::value<unsigned long long>
 Deprecated strongly-typed wrapper for unsigned long long values.
using to_i8 = detail::value<std::int8_t>
 Deprecated strongly-typed wrapper for std::int8_t values.
using to_i16 = detail::value<std::int16_t>
 Deprecated strongly-typed wrapper for std::int16_t values.
using to_i32 = detail::value<std::int32_t>
 Deprecated strongly-typed wrapper for std::int32_t values.
using to_i64 = detail::value<std::int64_t>
 Deprecated strongly-typed wrapper for std::int64_t values.
using to_u8 = detail::value<std::uint8_t>
 Deprecated strongly-typed wrapper for std::uint8_t values.
using to_u16 = detail::value<std::uint16_t>
 Deprecated strongly-typed wrapper for std::uint16_t values.
using to_u32 = detail::value<std::uint32_t>
 Deprecated strongly-typed wrapper for std::uint32_t values.
using to_u64 = detail::value<std::uint64_t>
 Deprecated strongly-typed wrapper for std::uint64_t values.
using to_f = detail::value<float>
 Deprecated strongly-typed wrapper for float values.
using to_d = detail::value<double>
 Deprecated strongly-typed wrapper for double values.
using to_ld = detail::value<long double>
 Deprecated strongly-typed wrapper for long double values.
Deprecated Value Wrappers

The v5.0.1 names of the to_* value wrappers.

The Boost UT style names, with a leading underscore, kept for compatibility with the existing applications. Each one is an alias of the corresponding to_* wrapper, so the wrapped values are compared and reported in the same way. They do not conflict with the literal operators with the same suffixes (42_i), which are in the literals namespace.

GCC reports the deprecation only when the alias names the type of a declaration, not when it is used in an expression, as in _i (expr); Clang reports it in both cases.

Deprecated
Pass the plain values to the function comparators eq(), ne(), gt(), ge(), lt(), and le() instead; the to_* value wrappers that replaced these aliases (since 3.2.0) are deprecated too (since 6.0.0).
using _b = to_b
 Deprecated strongly-typed wrapper for bool values, the v5.0.1 name of to_b.
using _c = to_c
 Deprecated strongly-typed wrapper for char values, the v5.0.1 name of to_c.
using _sc = to_sc
 Deprecated strongly-typed wrapper for signed char values, the v5.0.1 name of to_sc.
using _s = to_s
 Deprecated strongly-typed wrapper for short values, the v5.0.1 name of to_s.
using _i = to_i
 Deprecated strongly-typed wrapper for int values, the v5.0.1 name of to_i.
using _l = to_l
 Deprecated strongly-typed wrapper for long values, the v5.0.1 name of to_l.
using _ll = to_ll
 Deprecated strongly-typed wrapper for long long values, the v5.0.1 name of to_ll.
using _u = to_u
 Deprecated strongly-typed wrapper for unsigned values, the v5.0.1 name of to_u.
using _uc = to_uc
 Deprecated strongly-typed wrapper for unsigned char values, the v5.0.1 name of to_uc.
using _us = to_us
 Deprecated strongly-typed wrapper for unsigned short values, the v5.0.1 name of to_us.
using _ul = to_ul
 Deprecated strongly-typed wrapper for unsigned long values, the v5.0.1 name of to_ul.
using _ull = to_ull
 Deprecated strongly-typed wrapper for unsigned long long values, the v5.0.1 name of to_ull.
using _i8 = to_i8
 Deprecated strongly-typed wrapper for std::int8_t values, the v5.0.1 name of to_i8.
using _i16 = to_i16
 Deprecated strongly-typed wrapper for std::int16_t values, the v5.0.1 name of to_i16.
using _i32 = to_i32
 Deprecated strongly-typed wrapper for std::int32_t values, the v5.0.1 name of to_i32.
using _i64 = to_i64
 Deprecated strongly-typed wrapper for std::int64_t values, the v5.0.1 name of to_i64.
using _u8 = to_u8
 Deprecated strongly-typed wrapper for std::uint8_t values, the v5.0.1 name of to_u8.
using _u16 = to_u16
 Deprecated strongly-typed wrapper for std::uint16_t values, the v5.0.1 name of to_u16.
using _u32 = to_u32
 Deprecated strongly-typed wrapper for std::uint32_t values, the v5.0.1 name of to_u32.
using _u64 = to_u64
 Deprecated strongly-typed wrapper for std::uint64_t values, the v5.0.1 name of to_u64.
using _f = to_f
 Deprecated strongly-typed wrapper for float values, the v5.0.1 name of to_f.
using _d = to_d
 Deprecated strongly-typed wrapper for double values, the v5.0.1 name of to_d.
using _ld = to_ld
 Deprecated strongly-typed wrapper for long double values, the v5.0.1 name of to_ld.
template<class T>
using _t = to_t<T>
 Deprecated generic strongly-typed wrapper, the v5.0.1 name of to_t.

Enumerations

enum class  colour_mode {
  colour_mode::automatic ,
  colour_mode::always ,
  colour_mode::never
}
 The use of colours in the console output. More...
enum class  reporter_kind {
  reporter_kind::tap ,
  reporter_kind::human
}
 The built-in reporters. More...
enum class  verbosity {
  verbosity::silent = 0 ,
  verbosity::quiet = 1 ,
  verbosity::normal = 2 ,
  verbosity::verbose = 3
}
 The verbosity levels for test reporting. More...

Functions

template<class First_T, class Second_T, class... Rest_T>
requires (extension::checkable<std::remove_cvref_t<First_T>> and extension::checkable<std::remove_cvref_t<Second_T>> and
(extension::checkable<std::remove_cvref_t<Rest_T>> and ...))
constexpr auto all_of (First_T &&first, Second_T &&second, Rest_T &&... rest)
 Generic logical and operation, for two or more operands.
template<class First_T, class Second_T, class... Rest_T>
requires (extension::checkable<std::remove_cvref_t<First_T>> and extension::checkable<std::remove_cvref_t<Second_T>> and
(extension::checkable<std::remove_cvref_t<Rest_T>> and ...))
constexpr auto any_of (First_T &&first, Second_T &&second, Rest_T &&... rest)
 Generic logical (inclusive) or operation, for two or more operands.
template<class Lhs_T, class Rhs_T, class Epsilon_T>
requires (extension::approx_operand<Lhs_T> and extension::approx_operand<Rhs_T> and extension::approx_operand<Epsilon_T>)
constexpr auto approx (Lhs_T &&lhs, Rhs_T &&rhs, Epsilon_T &&epsilon)
 Approximate equality comparator, with an explicit tolerance.
template<class Lhs_T, class Rhs_T>
requires detail::comparable_operands<detail::comparison::equal, Lhs_T, Rhs_T>
constexpr auto eq (Lhs_T &&lhs, Rhs_T &&rhs)
 Generic equality comparator.
template<class Lhs_T, class Rhs_T>
requires detail::comparable_operands<detail::comparison::greater_equal, Lhs_T, Rhs_T>
constexpr auto ge (Lhs_T &&lhs, Rhs_T &&rhs)
 Generic greater than or equal comparator.
template<class Lhs_T, class Rhs_T>
requires detail::comparable_operands<detail::comparison::greater, Lhs_T, Rhs_T>
constexpr auto gt (Lhs_T &&lhs, Rhs_T &&rhs)
 Generic greater than comparator.
template<class Lhs_T, class Rhs_T>
requires detail::comparable_operands<detail::comparison::less_equal, Lhs_T, Rhs_T>
constexpr auto le (Lhs_T &&lhs, Rhs_T &&rhs)
 Generic less than or equal comparator.
template<class Lhs_T, class Rhs_T>
requires detail::comparable_operands<detail::comparison::less, Lhs_T, Rhs_T>
constexpr auto lt (Lhs_T &&lhs, Rhs_T &&rhs)
 Generic less than comparator.
template<class Lhs_T, class Rhs_T>
requires detail::comparable_operands<detail::comparison::not_equal, Lhs_T, Rhs_T>
constexpr auto ne (Lhs_T &&lhs, Rhs_T &&rhs)
 Generic non-equality comparator.
template<class Expr_T>
requires extension::checkable<std::remove_cvref_t<Expr_T>>
constexpr auto negate (Expr_T &&expr)
 Generic logical not operation.
template<class Callable_T>
requires std::invocable<Callable_T&>
auto nothrow (Callable_T &&func)
 Checks whether a callable does not throw any exception, for expect() or require().
template<class Callable_T>
requires std::invocable<Callable_T&>
auto throws (Callable_T &&func)
 Checks whether a callable throws any exception, for expect() or require().
template<class Exception_T, class Callable_T>
requires std::invocable<Callable_T&>
auto throws (Callable_T &&func)
 Checks whether a callable throws a specific exception, for expect() or require().
Deprecated Functions
template<class Expr_T>
constexpr auto _not (Expr_T &&expr)
 Deprecated generic logical not operation, the v5.0.1 name of negate().
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().
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().
template<class T>
constexpr auto mut (const T &t) noexcept -> T &
 Deprecated generic mutator to remove const qualification from a reference.
template<class T>
requires std::is_floating_point_v<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.

Detailed Description

The micro_os_plus::micro_test_plus namespace encapsulates all core components, types, and utilities of the µTest++ testing framework, providing a dedicated scope for its public API.

The main classes (the runner, the suites, and the test cases) are defined directly in this namespace. Several nested namespaces group specific aspects of the framework: extension (the concepts for custom comparators, operators, and helpers), reflection (source locations and type names), utility (utility functions), and detail (internal implementation details, including the reporters, the mathematical utilities of detail::math, and the value wrappers). The namespaces literals (user-defined literals), operators (comparison and logical operators), and type_traits (the v5.0.1 concepts) are deprecated, and are kept for the earlier code.

The declarations are in the headers of the include/micro-os-plus/micro-test-plus folder, and the non-inline definitions in the src folder.