|
micro-test-plus 4.1.0
µTest++ Testing Framework
|
Primary namespace for the µTest++ testing framework. More...
Namespaces | |
| namespace | detail |
| Internal implementation details for the µTest++ framework. | |
| namespace | literals |
| User-defined literals and type wrappers for the µTest++ testing framework. | |
| namespace | math |
| Mathematical utilities for the µTest++ testing framework. | |
| namespace | operators |
| Custom operator overloads for expressive and type-safe test assertions. | |
| namespace | reflection |
| Reflection utilities for the µTest++ testing framework. | |
| namespace | type_traits |
| Type trait utilities and metaprogramming support for the µTest++ testing framework. | |
| namespace | utility |
| Utility functions for the µTest++ testing framework. | |
Classes | |
| struct | _t |
| Deprecated generic strongly-typed wrapper for explicit type conversion. More... | |
| class | reporter |
| Reporter to display test results, including operand values and types for failures. More... | |
| class | reporter_human |
| Human (standard output) implementation of reporter. More... | |
| class | reporter_tap |
| TAP (Test Anything Protocol) implementation of reporter. More... | |
| class | runner |
| The test runner for the µTest++ framework. More... | |
| class | static_runner |
| A runner variant that also manages statically-registered test suites. More... | |
| class | static_suite |
| A test suite designed for static (namespace-scope) registration with a static_runner. More... | |
| class | subtest |
| A named, runnable test case that lives inside a suite. More... | |
| class | suite |
| A named, runnable test suite registered with the test runner. More... | |
| struct | to_t |
| Generic strongly-typed wrapper for explicit type conversion. More... | |
| class | top_suite |
| The implicit top-level suite owned by every runner instance. More... | |
Typedefs | |
Deprecated Type Wrappers | |
Strongly-typed wrappers for explicit type conversion. These type aliases provide wrappers for converting values and expressions to specific types for use with µTest++ comparators and test expressions. The _i, _u8, etc. forms are now deprecated as of version 3.2.0. Please use the preferred to_* type wrappers for new code, as they offer improved clarity and consistency.
| |
| using | _b = type_traits::value<bool> |
| Strongly-typed wrapper for bool values. | |
| using | _c = type_traits::value<char> |
| Strongly-typed wrapper for char values. | |
| using | _sc = type_traits::value<signed char> |
| Strongly-typed wrapper for signed char values. | |
| using | _s = type_traits::value<short> |
| Strongly-typed wrapper for short values. | |
| using | _i = type_traits::value<int> |
| Strongly-typed wrapper for int values. | |
| using | _l = type_traits::value<long> |
| Strongly-typed wrapper for long values. | |
| using | _ll = type_traits::value<long long> |
| Strongly-typed wrapper for long long values. | |
| using | _u = type_traits::value<unsigned> |
| Strongly-typed wrapper for unsigned values. | |
| using | _uc = type_traits::value<unsigned char> |
| Strongly-typed wrapper for unsigned char values. | |
| using | _us = type_traits::value<unsigned short> |
| Strongly-typed wrapper for unsigned short values. | |
| using | _ul = type_traits::value<unsigned long> |
| Strongly-typed wrapper for unsigned long values. | |
| using | _ull = type_traits::value<unsigned long long> |
| Strongly-typed wrapper for unsigned long long values. | |
| using | _i8 = type_traits::value<std::int8_t> |
| Strongly-typed wrapper for std::int8_t values. | |
| using | _i16 = type_traits::value<std::int16_t> |
| Strongly-typed wrapper for std::int16_t values. | |
| using | _i32 = type_traits::value<std::int32_t> |
| Strongly-typed wrapper for std::int32_t values. | |
| using | _i64 = type_traits::value<std::int64_t> |
| Strongly-typed wrapper for std::int64_t values. | |
| using | _u8 = type_traits::value<std::uint8_t> |
| Strongly-typed wrapper for std::uint8_t values. | |
| using | _u16 = type_traits::value<std::uint16_t> |
| Strongly-typed wrapper for std::uint16_t values. | |
| using | _u32 = type_traits::value<std::uint32_t> |
| Strongly-typed wrapper for std::uint32_t values. | |
| using | _u64 = type_traits::value<std::uint64_t> |
| Strongly-typed wrapper for std::uint64_t values. | |
| using | _f = type_traits::value<float> |
| Strongly-typed wrapper for float values. | |
| using | _d = type_traits::value<double> |
| Strongly-typed wrapper for double values. | |
| using | _ld = type_traits::value<long double> |
| Strongly-typed wrapper for long double values. | |
Type Wrappers | |
Strongly-typed wrappers for converting dynamic values and expressions to specific types recognised by µTest++ comparators. These type aliases provide a modern, type-safe mechanism for explicitly converting values to the required types for µTest++ test expressions and comparators. Each alias is a wrapper around type_traits::value<T>, ensuring that the value is treated as the specified type within the framework. The to_* forms are the preferred approach since version 3.2.0, superseding the older _i, _u8, etc. aliases, which are now deprecated.
int x = 42;
// Explicitly treat x as an int for test comparison.
auto wrapped = to_i{x};
| |
| using | to_b = type_traits::value<bool> |
| Strongly-typed wrapper for bool values. | |
| using | to_c = type_traits::value<char> |
| Strongly-typed wrapper for char values. | |
| using | to_sc = type_traits::value<signed char> |
| Strongly-typed wrapper for signed char values. | |
| using | to_s = type_traits::value<short> |
| Strongly-typed wrapper for short values. | |
| using | to_i = type_traits::value<int> |
| Strongly-typed wrapper for int values. | |
| using | to_l = type_traits::value<long> |
| Strongly-typed wrapper for long values. | |
| using | to_ll = type_traits::value<long long> |
| Strongly-typed wrapper for long long values. | |
| using | to_u = type_traits::value<unsigned> |
| Strongly-typed wrapper for unsigned values. | |
| using | to_uc = type_traits::value<unsigned char> |
| Strongly-typed wrapper for unsigned char values. | |
| using | to_us = type_traits::value<unsigned short> |
| Strongly-typed wrapper for unsigned short values. | |
| using | to_ul = type_traits::value<unsigned long> |
| Strongly-typed wrapper for unsigned long values. | |
| using | to_ull = type_traits::value<unsigned long long> |
| Strongly-typed wrapper for unsigned long long values. | |
| using | to_i8 = type_traits::value<std::int8_t> |
| Strongly-typed wrapper for std::int8_t values. | |
| using | to_i16 = type_traits::value<std::int16_t> |
| Strongly-typed wrapper for std::int16_t values. | |
| using | to_i32 = type_traits::value<std::int32_t> |
| Strongly-typed wrapper for std::int32_t values. | |
| using | to_i64 = type_traits::value<std::int64_t> |
| Strongly-typed wrapper for std::int64_t values. | |
| using | to_u8 = type_traits::value<std::uint8_t> |
| Strongly-typed wrapper for std::uint8_t values. | |
| using | to_u16 = type_traits::value<std::uint16_t> |
| Strongly-typed wrapper for std::uint16_t values. | |
| using | to_u32 = type_traits::value<std::uint32_t> |
| Strongly-typed wrapper for std::uint32_t values. | |
| using | to_u64 = type_traits::value<std::uint64_t> |
| Strongly-typed wrapper for std::uint64_t values. | |
| using | to_f = type_traits::value<float> |
| Strongly-typed wrapper for float values. | |
| using | to_d = type_traits::value<double> |
| Strongly-typed wrapper for double values. | |
| using | to_ld = type_traits::value<long double> |
| Strongly-typed wrapper for long double values. | |
Enumerations | |
| enum class | verbosity { silent = 0 , quiet = 1 , normal = 2 , verbose = 3 } |
| The verbosity levels for test reporting. More... | |
Functions | |
| template<class Lhs_T, class Rhs_T> | |
| constexpr auto | _and (const Lhs_T &lhs, const Rhs_T &rhs) |
| Generic logical and operation. | |
| template<class Expr_T> | |
| constexpr auto | _not (const Expr_T &expr) |
| Generic logical not operation. | |
| template<class Lhs_T, class Rhs_T> | |
| constexpr auto | _or (const Lhs_T &lhs, const Rhs_T &rhs) |
| Generic logical or operation. | |
| reporter & | endl (reporter &stream) |
| Output stream manipulator for ending a line in test reports. | |
| template<class Lhs_T, class Rhs_T> | |
| constexpr auto | eq (const Lhs_T &lhs, const Rhs_T &rhs) |
| Generic equality comparator for non-pointer types. | |
| template<class Lhs_T, class Rhs_T> | |
| constexpr auto | eq (Lhs_T *lhs, Rhs_T *rhs) |
| Pointer equality comparator for any pointer types. | |
| template<class Lhs_T, class Rhs_T> | |
| constexpr auto | ge (const Lhs_T &lhs, const Rhs_T &rhs) |
| Generic greater than or equal comparator. | |
| template<class Lhs_T, class Rhs_T> | |
| constexpr auto | ge (Lhs_T *lhs, Rhs_T *rhs) |
| Pointer greater than or equal comparator. | |
| template<class Lhs_T, class Rhs_T> | |
| constexpr auto | gt (const Lhs_T &lhs, const Rhs_T &rhs) |
| Generic greater than comparator. | |
| template<class Lhs_T, class Rhs_T> | |
| constexpr auto | gt (Lhs_T *lhs, Rhs_T *rhs) |
| Pointer greater than comparator. | |
| detail::indent_t | indent (size_t level) |
| Factory function that creates an indent_t manipulator. | |
| template<class Lhs_T, class Rhs_T> | |
| constexpr auto | le (const Lhs_T &lhs, const Rhs_T &rhs) |
| Generic less than or equal comparator. | |
| template<class Lhs_T, class Rhs_T> | |
| constexpr auto | le (Lhs_T *lhs, Rhs_T *rhs) |
| Pointer less than or equal comparator. | |
| template<class Lhs_T, class Rhs_T> | |
| constexpr auto | lt (const Lhs_T &lhs, const Rhs_T &rhs) |
| Generic less than comparator. | |
| template<class Lhs_T, class Rhs_T> | |
| constexpr auto | lt (Lhs_T *lhs, Rhs_T *rhs) |
| Pointer less than comparator. | |
| template<class T> | |
| constexpr auto | mut (const T &t) noexcept -> T & |
| Generic mutator to remove const qualification from any type. | |
| template<class Lhs_T, class Rhs_T> | |
| constexpr auto | ne (const Lhs_T &lhs, const Rhs_T &rhs) |
| Generic non-equality comparator. | |
| template<class Lhs_T, class Rhs_T> | |
| constexpr auto | ne (Lhs_T *lhs, Rhs_T *rhs) |
| Pointer non-equality comparator. | |
| template<class Callable_T> | |
| constexpr auto | nothrow (const Callable_T &func) |
| Check if a callable does not throw an exception. | |
| template<class Callable_T> | |
| constexpr auto | throws (const Callable_T &func) |
| Check if a callable throws an exception (any exception). | |
| template<class Exception_T, class Callable_T> | |
| constexpr auto | throws (const Callable_T &func) |
| Check if a callable throws a specific exception. | |
Variables | |
| constexpr size_t | indent_size = 4 |
| Number of spaces per indentation level. | |
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.
This namespace is structured into several nested namespaces, each responsible for a specific aspect of the framework, such as mathematical utilities, type traits, literals, test suite and test case management, test runners, test reporters, internal details, operators, and utility functions.
By grouping all definitions within this namespace and its sub-namespaces, the framework achieves clear code organisation, minimises naming conflicts, and enhances maintainability. This modular structure supports robust, scalable, and professional test development for both embedded and general C++ projects.
All public API definitions are implemented in the include/micro-os-plus folder, ensuring a clear separation from user code and facilitating straightforward integration with the wider µOS++ ecosystem.
|
strong |
The verbosity enumeration defines the available levels of detail for test output produced by the reporting system. These levels control the amount and type of information displayed during test execution, allowing users to tailor the output to their specific requirements.
Selecting an appropriate verbosity level enhances the usability of test reports, whether for concise summaries or comprehensive diagnostics.
Definition at line 101 of file reporter.h.
| stream | Reference to the reporter instance. |
The endl function inserts a newline character into the specified reporter stream and flushes its output buffer. This operation ensures that each test output line is clearly separated and immediately visible, facilitating the readability and clarity of test results across all test cases and folders within the µTest++ framework.
Definition at line 206 of file reporter.cpp.
Referenced by micro_os_plus::micro_test_plus::reporter_tap::output_fail_prefix_(), micro_os_plus::micro_test_plus::reporter_human::output_fail_suffix_(), micro_os_plus::micro_test_plus::reporter_tap::output_fail_suffix_(), micro_os_plus::micro_test_plus::reporter_human::output_pass_suffix_(), and micro_os_plus::micro_test_plus::reporter_tap::output_pass_suffix_().
|
inlinenodiscard |
| level | The number of four-space indentation levels. |
Definition at line 79 of file reporter-inlines.h.
Referenced by micro_os_plus::micro_test_plus::reporter_human::begin_subtest(), micro_os_plus::micro_test_plus::reporter_tap::begin_subtest(), micro_os_plus::micro_test_plus::reporter_human::end_subtest(), micro_os_plus::micro_test_plus::reporter_tap::end_subtest(), micro_os_plus::micro_test_plus::reporter_human::end_suite(), micro_os_plus::micro_test_plus::reporter_tap::end_suite(), micro_os_plus::micro_test_plus::reporter_human::output_fail_prefix_(), micro_os_plus::micro_test_plus::reporter_tap::output_fail_prefix_(), micro_os_plus::micro_test_plus::reporter_tap::output_fail_suffix_(), micro_os_plus::micro_test_plus::reporter_human::output_pass_prefix_(), and micro_os_plus::micro_test_plus::reporter_tap::output_pass_prefix_().
|
constexpr |
Used by operator<<(indent_t) and related methods to compute the leading whitespace for each nesting depth.
Definition at line 124 of file reporter-human.cpp.
Referenced by micro_os_plus::micro_test_plus::reporter_human::begin_subtest(), micro_os_plus::micro_test_plus::reporter_tap::begin_subtest(), micro_os_plus::micro_test_plus::reporter_human::end_subtest(), micro_os_plus::micro_test_plus::reporter_tap::end_subtest(), micro_os_plus::micro_test_plus::reporter_human::end_suite(), micro_os_plus::micro_test_plus::reporter_tap::end_suite(), micro_os_plus::micro_test_plus::reporter_human::operator<<(), and micro_os_plus::micro_test_plus::reporter_tap::operator<<().