micro-test-plus 6.0.1
µTest++ Testing Framework
Loading...
Searching...
No Matches
detail.h File Reference

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

#include "extension.h"
#include "math.h"
#include <algorithm>
#include <compare>
#include <concepts>
#include <cstddef>
#include <cstdio>
#include <string>
#include <string_view>
#include <type_traits>
#include <utility>
#include "inlines/detail-inlines.h"

Go to the source code of this file.

Classes

struct  micro_os_plus::micro_test_plus::detail::and_op< Lhs_T, Rhs_T >
 Logical AND comparator struct template. More...
struct  micro_os_plus::micro_test_plus::detail::approx_op< Lhs_T, Rhs_T, Epsilon_T >
 Approximate comparator struct template. More...
struct  micro_os_plus::micro_test_plus::detail::array_operand< T >
 An array operand of a comparator, other than a character array. More...
struct  micro_os_plus::micro_test_plus::detail::basic_c_string< Char_T >
 A C string operand of a comparator. More...
struct  micro_os_plus::micro_test_plus::detail::binary_op< Lhs_T, Rhs_T >
 Common base struct template for binary comparators. More...
struct  micro_os_plus::micro_test_plus::detail::callable_op
 Common base struct for callable-wrapping operators. More...
struct  micro_os_plus::micro_test_plus::detail::callable_result
 The result of the invocation of the callable of a check. More...
struct  micro_os_plus::micro_test_plus::detail::compare_op< Lhs_T, Rhs_T, Compare_T >
 Relational comparator struct template. More...
struct  micro_os_plus::micro_test_plus::extension::compare_op< Lhs_T, Rhs_T, Compare_T >
 Relational comparator struct template. More...
struct  micro_os_plus::micro_test_plus::detail::equal_to
 Equality tag for compare_op. More...
struct  micro_os_plus::micro_test_plus::detail::failed_requirement
 The exception thrown to stop a test case after a failed require(). More...
struct  micro_os_plus::micro_test_plus::detail::greater
 Greater than tag for compare_op. More...
struct  micro_os_plus::micro_test_plus::detail::greater_equal
 Greater than or equal tag for compare_op. More...
struct  micro_os_plus::micro_test_plus::detail::less
 Less than tag for compare_op. More...
struct  micro_os_plus::micro_test_plus::detail::less_equal
 Less than or equal tag for compare_op. More...
struct  micro_os_plus::micro_test_plus::detail::not_equal_to
 Non-equality tag for compare_op. More...
struct  micro_os_plus::micro_test_plus::detail::not_op< T >
 Logical NOT comparator struct template. More...
struct  micro_os_plus::micro_test_plus::detail::nothrow_op
 Operator struct to check if an expression does not throw any exception. More...
struct  micro_os_plus::micro_test_plus::detail::or_op< Lhs_T, Rhs_T >
 Logical OR comparator struct template. More...
struct  micro_os_plus::micro_test_plus::detail::predicate_op< T, Predicate_T >
 Unary predicate struct template. More...
struct  micro_os_plus::micro_test_plus::extension::predicate_op< T, Predicate_T >
 Unary predicate struct template. More...
struct  micro_os_plus::micro_test_plus::detail::throws_op< Exception_T >
 Operator struct template to check if an expression throws a specific exception. More...
struct  micro_os_plus::micro_test_plus::detail::throws_op< void >
 Operator struct to check if an expression throws any exception. More...
struct  micro_os_plus::micro_test_plus::detail::unary_op< T >
 Common base struct template for unary comparators. More...

Namespaces

namespace  micro_os_plus
 The primary namespace for the µOS++ framework.
namespace  micro_os_plus::micro_test_plus
 Primary namespace for the µTest++ testing framework.
namespace  micro_os_plus::micro_test_plus::detail
 Internal implementation details for the µTest++ framework.
namespace  micro_os_plus::micro_test_plus::extension
 The templates and the concepts for extending the µTest++ testing framework.

Concepts

concept  micro_os_plus::micro_test_plus::detail::character
 Concept satisfied by the character types.
concept  micro_os_plus::micro_test_plus::detail::character_pointer
 Concept satisfied by the pointers to the character types.
concept  micro_os_plus::micro_test_plus::extension::approx_operand
 Concept satisfied when T is a valid operand of the approximate comparator.

Macros

#define MICRO_OS_PLUS_MICRO_TEST_PLUS_PRI_SIZE   "zu"
 Portable printf() conversion for the size_t values.

Typedefs

using micro_os_plus::micro_test_plus::detail::c_string = basic_c_string<char>
 The C string operand of char strings.
template<class T>
using micro_os_plus::micro_test_plus::detail::stored_operand_t
 The type with which an expression stores an operand.
template<class T>
using micro_os_plus::micro_test_plus::detail::unwrapped_t
 The type of an operand, after the framework wrappers are removed by detail::unwrap().

Enumerations

enum class  micro_os_plus::micro_test_plus::detail::throw_outcome : unsigned char {
  micro_os_plus::micro_test_plus::detail::none ,
  micro_os_plus::micro_test_plus::detail::std_exception ,
  micro_os_plus::micro_test_plus::detail::unknown_exception
}
 The kind of exception thrown by the callable of a check. More...

Functions

template<typename Lhs_T, typename Rhs_T>
 micro_os_plus::micro_test_plus::detail::and_op (Lhs_T &&, Rhs_T &&) -> and_op< stored_operand_t< Lhs_T >, stored_operand_t< Rhs_T > >
 Deduction guide for the logical AND comparator.
template<class T>
requires std::is_arithmetic_v<T>
void micro_os_plus::micro_test_plus::detail::append_number (std::string &buffer, T v)
 Appends the shortest decimal representation of a numeric value to a buffer.
template<class T>
void micro_os_plus::micro_test_plus::detail::append_pointer (std::string &buffer, T *v)
 Appends the hexadecimal address of a pointer to a buffer.
template<class Lhs_T, class Rhs_T, class Epsilon_T>
 micro_os_plus::micro_test_plus::detail::approx_op (Lhs_T &&, Rhs_T &&, Epsilon_T &&) -> approx_op< stored_operand_t< Lhs_T >, stored_operand_t< Rhs_T >, stored_operand_t< Epsilon_T > >
 Deduction guide for the approximate comparator.
template<class T>
constexpr auto micro_os_plus::micro_test_plus::detail::as_operand (T &&t) noexcept -> decltype(auto)
 Prepares an operand of a comparator.
template<class Lhs_T, class Rhs_T, class Compare_T>
 micro_os_plus::micro_test_plus::detail::compare_op (Lhs_T &&, Rhs_T &&, Compare_T) -> compare_op< stored_operand_t< decltype(detail::as_operand(std::declval< Lhs_T >()))>, stored_operand_t< decltype(detail::as_operand(std::declval< Rhs_T >()))>, Compare_T >
 Deduction guide for the relational comparator.
template<class Lhs_T, class Rhs_T, class Epsilon_T>
constexpr bool micro_os_plus::micro_test_plus::detail::differ_by_at_most (Lhs_T lhs, Rhs_T rhs, Epsilon_T epsilon)
 Tells whether two numbers differ by at most a tolerance.
template<class T, class R>
requires (container_like<R> and std::three_way_comparable_with< T, typename range_element<R>::type>)
constexpr auto micro_os_plus::micro_test_plus::detail::operator<=> (const array_operand< T > &lhs, const R &rhs)
 Orders an array operand and a range lexicographically.
template<character Char_T>
constexpr std::strong_ordering micro_os_plus::micro_test_plus::detail::operator<=> (const basic_c_string< Char_T > &lhs, const basic_c_string< Char_T > &rhs) noexcept
 Orders two C string operands.
template<character Char_T>
constexpr std::strong_ordering micro_os_plus::micro_test_plus::detail::operator<=> (const basic_c_string< Char_T > &lhs, std::type_identity_t< std::basic_string_view< Char_T > > rhs) noexcept
 Orders a C string operand and a string.
template<class T, class R>
requires (container_like<R> and std::equality_comparable_with< T, typename range_element<R>::type>)
constexpr bool micro_os_plus::micro_test_plus::detail::operator== (const array_operand< T > &lhs, const R &rhs)
 Compares an array operand with a range for equality.
template<character Char_T>
constexpr bool micro_os_plus::micro_test_plus::detail::operator== (const basic_c_string< Char_T > &lhs, const basic_c_string< Char_T > &rhs) noexcept
 Compares two C string operands for equality.
template<character Char_T>
constexpr bool micro_os_plus::micro_test_plus::detail::operator== (const basic_c_string< Char_T > &lhs, std::nullptr_t) noexcept
 Checks whether a C string operand is a null pointer.
template<character Char_T>
constexpr bool micro_os_plus::micro_test_plus::detail::operator== (const basic_c_string< Char_T > &lhs, std::type_identity_t< std::basic_string_view< Char_T > > rhs) noexcept
 Compares a C string operand with a string.
template<typename Lhs_T, typename Rhs_T>
 micro_os_plus::micro_test_plus::detail::or_op (Lhs_T &&, Rhs_T &&) -> or_op< stored_operand_t< Lhs_T >, stored_operand_t< Rhs_T > >
 Deduction guide for the logical OR comparator.
template<class T, class Predicate_T>
 micro_os_plus::micro_test_plus::detail::predicate_op (T &&, Predicate_T) -> predicate_op< stored_operand_t< decltype(detail::as_operand(std::declval< T >()))>, Predicate_T >
 Deduction guide for the unary predicate.
template<class T>
decltype(auto) constexpr micro_os_plus::micro_test_plus::detail::unwrap (const T &t)
 Returns the value wrapped by a framework type, or the operand itself.
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.

Detailed Description

This header provides the declarations for the internal components of the µTest++ framework, encapsulated within the micro_os_plus::micro_test_plus::detail namespace. It defines the core mechanisms, helper structures, and utility templates that underpin the framework's value retrieval, comparator logic, operand preparation, and exception checking facilities.

All definitions reside within the micro_os_plus::micro_test_plus::detail namespace.

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

Definition in file detail.h.

Macro Definition Documentation

◆ MICRO_OS_PLUS_MICRO_TEST_PLUS_PRI_SIZE

#define MICRO_OS_PLUS_MICRO_TEST_PLUS_PRI_SIZE   "zu"

The format checker of Clang (MSVC target) on Windows rejects the standard z modifier, even though the C runtime printf() implementation supports it, so the Microsoft-specific I modifier is used there ("Iu"). The format checker of GCC (MinGW-w64, the "ms_printf" archetype) rejects z too, but also ignores I, so the modifier that matches the width of size_t is used ("llu" for 64-bit Windows, "u" for 32-bit Windows). Elsewhere, including Clang for MinGW, it is "zu".

It is used in all the library formats that print size_t values, in the reporter output and in the trace messages alike, concatenated with the adjacent string literals, as the standard PRIu32 macros are (for example "%" MICRO_OS_PLUS_MICRO_TEST_PLUS_PRI_SIZE " checks").

The templates in the inline headers use it too; their string literals are concatenated when they are parsed, not when they are instantiated, so the macro is undefined at the end of micro-test-plus.h, after all the headers, to keep it out of the application code. The library sources include the individual headers, which keep it defined.

Definition at line 102 of file detail.h.

Referenced by micro_os_plus::micro_test_plus::detail::runnable_base::runnable_base(), micro_os_plus::micro_test_plus::suite::suite(), micro_os_plus::micro_test_plus::test_case::test_case(), micro_os_plus::micro_test_plus::detail::reporter_tap::end_session(), micro_os_plus::micro_test_plus::detail::reporter_tap::end_suite(), micro_os_plus::micro_test_plus::detail::reporter_human::end_test_case(), micro_os_plus::micro_test_plus::detail::reporter_tap::end_test_case(), micro_os_plus::micro_test_plus::detail::reporter::format_session_totals(), micro_os_plus::micro_test_plus::detail::anonymous_namespace{reporter.cpp}::format_skipped(), micro_os_plus::micro_test_plus::detail::reporter::format_suite_totals(), micro_os_plus::micro_test_plus::detail::reporter::format_test_case_totals(), micro_os_plus::micro_test_plus::counters::operator+=(), micro_os_plus::micro_test_plus::runner::run_suites(), micro_os_plus::micro_test_plus::detail::reporter_tap::skip_suite(), and micro_os_plus::micro_test_plus::detail::reporter_tap::skip_test_case().