micro-test-plus 3.2.0
µTest++, a lightweight testing framework for embedded platforms
Loading...
Searching...
No Matches
micro_os_plus::micro_test_plus Namespace Reference

Namespaces

namespace  detail
 Namespace with implementation details, not part of the public API.
 
namespace  literals
 User Defined Literals (UDL). Use them to suffix constants and obtain specific explicit types, like 1_i.
 
namespace  math
 Local mathematical functions.
 
namespace  operators
 Separate namespace with custom operators.
 
namespace  reflection
 
namespace  type_traits
 Local type traits. Some may have standard equivalents, but better keep them locally.
 
namespace  utility
 

Classes

struct  _t
 
struct  colors
 Colours used to highlight pass vs. fail. More...
 
class  test_reporter
 Reporter to display the test results. For failed tests it prints the actual values of the operands, with their types. More...
 
class  test_runner
 The test runner. It maintains a list of test suites which automatically register themselves in their constructors. More...
 
class  test_suite
 Test suites are classes that represent a named group of test cases which self register to the runner. More...
 
class  test_suite_base
 Base class for all test suites. More...
 
struct  to_t
 Template for wrapping any other type. More...
 

Typedefs

using _b = type_traits::value<bool>
 
using _c = type_traits::value<char>
 
using _d = type_traits::value<double>
 
using _f = type_traits::value<float>
 
using _i = type_traits::value<int>
 
using _i16 = type_traits::value<std::int16_t>
 
using _i32 = type_traits::value<std::int32_t>
 
using _i64 = type_traits::value<std::int64_t>
 
using _i8 = type_traits::value<std::int8_t>
 
using _l = type_traits::value<long>
 
using _ld = type_traits::value<long double>
 
using _ll = type_traits::value<long long>
 
using _s = type_traits::value<short>
 
using _sc = type_traits::value<signed char>
 
using _u = type_traits::value<unsigned>
 
using _u16 = type_traits::value<std::uint16_t>
 
using _u32 = type_traits::value<std::uint32_t>
 
using _u64 = type_traits::value<std::uint64_t>
 
using _u8 = type_traits::value<std::uint8_t>
 
using _uc = type_traits::value<unsigned char>
 
using _ul = type_traits::value<unsigned long>
 
using _ull = type_traits::value<unsigned long long>
 
using _us = type_traits::value<unsigned short>
 
using to_b = type_traits::value<bool>
 
using to_c = type_traits::value<char>
 
using to_d = type_traits::value<double>
 
using to_f = type_traits::value<float>
 
using to_i = type_traits::value<int>
 
using to_i16 = type_traits::value<std::int16_t>
 
using to_i32 = type_traits::value<std::int32_t>
 
using to_i64 = type_traits::value<std::int64_t>
 
using to_i8 = type_traits::value<std::int8_t>
 
using to_l = type_traits::value<long>
 
using to_ld = type_traits::value<long double>
 
using to_ll = type_traits::value<long long>
 
using to_s = type_traits::value<short>
 
using to_sc = type_traits::value<signed char>
 
using to_u = type_traits::value<unsigned>
 
using to_u16 = type_traits::value<std::uint16_t>
 
using to_u32 = type_traits::value<std::uint32_t>
 
using to_u64 = type_traits::value<std::uint64_t>
 
using to_u8 = type_traits::value<std::uint8_t>
 
using to_uc = type_traits::value<unsigned char>
 
using to_ul = type_traits::value<unsigned long>
 
using to_ull = type_traits::value<unsigned long long>
 
using to_us = type_traits::value<unsigned short>
 
typedef verbosity verbosity_t
 

Enumerations

enum class  verbosity {
  silent = 0 ,
  quiet = 1 ,
  normal = 2 ,
  verbose = 3
}
 The verbosity levels. More...
 

Functions

template<class Lhs_T , class Rhs_T >
constexpr auto _and (const Lhs_T &lhs, const Rhs_T &rhs)
 Generic logical and.
 
template<class Expr_T >
constexpr auto _not (const Expr_T &expr)
 Generic logical not.
 
template<class Lhs_T , class Rhs_T >
constexpr auto _or (const Lhs_T &lhs, const Rhs_T &rhs)
 Generic logical or.
 
template<class Expr_T , type_traits::requires_t< type_traits::is_op_v< Expr_T > or type_traits::is_convertible_v< Expr_T, bool > > = 0>
constexpr auto assume (const Expr_T &expr, const reflection::source_location &sl=reflection::source_location::current())
 Check a condition and, if false, abort.
 
test_reporterendl (test_reporter &stream)
 
template<class Lhs_T , class Rhs_T >
constexpr auto eq (const Lhs_T &lhs, const Rhs_T &rhs)
 Generic equality comparator. Matches any non-pointer type.
 
template<class Lhs_T , class Rhs_T >
constexpr auto eq (Lhs_T *lhs, Rhs_T *rhs)
 Pointer equality comparator. Matches pointers to any types.
 
int exit_code (void)
 Complete the test and return the exit code.
 
template<class Expr_T , type_traits::requires_t< type_traits::is_op_v< Expr_T > or type_traits::is_convertible_v< Expr_T, bool > > = 0>
constexpr auto expect (const Expr_T &expr, const reflection::source_location &sl=reflection::source_location::current())
 Evaluate a generic condition and report the results.
 
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.
 
void initialize (int argc, char *argv[], const char *name="Main")
 Initialize the test framework.
 
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)
 Generic 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)
 Generic less than comparator.
 
template<class T >
constexpr auto mut (const T &t) noexcept -> T &
 Generic mutator, to remove const 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 doesn't throw an exception.
 
template<typename Callable_T , typename... Args_T>
void test_case (const char *name, Callable_T &&callable, Args_T &&... arguments)
 Define and execute a test case.
 
template<class Exception_T , class Callable_T >
constexpr auto throws (const Callable_T &func)
 Check if a callable throws a specific exception.
 
template<class Callable_T >
constexpr auto throws (const Callable_T &func)
 Check if a callable throws an exception (any exception).
 

Variables

test_suite_basecurrent_test_suite
 
test_reporter reporter
 
test_runner runner
 

Typedef Documentation

◆ _b

Deprecated
Use to_b (since 3.2.0).

Definition at line 358 of file literals.h.

◆ _c

Deprecated
Use to_c (since 3.2.0).

Definition at line 360 of file literals.h.

◆ _d

Deprecated
Use to_d (since 3.2.0).

Definition at line 400 of file literals.h.

◆ _f

Deprecated
Use to_f (since 3.2.0).

Definition at line 398 of file literals.h.

◆ _i

Deprecated
Use to_i (since 3.2.0).

Definition at line 366 of file literals.h.

◆ _i16

Deprecated
Use to_i16 (since 3.2.0).

Definition at line 384 of file literals.h.

◆ _i32

Deprecated
Use to_i32 (since 3.2.0).

Definition at line 386 of file literals.h.

◆ _i64

Deprecated
Use to_i64 (since 3.2.0).

Definition at line 388 of file literals.h.

◆ _i8

Deprecated
Use to_i8 (since 3.2.0).

Definition at line 382 of file literals.h.

◆ _l

Deprecated
Use to_l (since 3.2.0).

Definition at line 368 of file literals.h.

◆ _ld

Deprecated
Use to_ld (since 3.2.0).

Definition at line 402 of file literals.h.

◆ _ll

Deprecated
Use to_ll (since 3.2.0).

Definition at line 370 of file literals.h.

◆ _s

Deprecated
Use to_s (since 3.2.0).

Definition at line 364 of file literals.h.

◆ _sc

Deprecated
Use to_sc (since 3.2.0).

Definition at line 362 of file literals.h.

◆ _u

Deprecated
Use to_u (since 3.2.0).

Definition at line 372 of file literals.h.

◆ _u16

Deprecated
Use to_u16 (since 3.2.0).

Definition at line 392 of file literals.h.

◆ _u32

Deprecated
Use to_u32 (since 3.2.0).

Definition at line 394 of file literals.h.

◆ _u64

Deprecated
Use to_u64 (since 3.2.0).

Definition at line 396 of file literals.h.

◆ _u8

Deprecated
Use to_u8 (since 3.2.0).

Definition at line 390 of file literals.h.

◆ _uc

Deprecated
Use to_uc (since 3.2.0).

Definition at line 374 of file literals.h.

◆ _ul

Deprecated
Use to_ul (since 3.2.0).

Definition at line 378 of file literals.h.

◆ _ull

Deprecated
Use to_ull (since 3.2.0).

Definition at line 380 of file literals.h.

◆ _us

Deprecated
Use to_us (since 3.2.0).

Definition at line 376 of file literals.h.

◆ verbosity_t

Enumeration Type Documentation

◆ verbosity

The verbosity levels.

Enumerator
silent 
quiet 
normal 
verbose 

Definition at line 65 of file test-reporter.h.

Function Documentation

◆ endl()

test_reporter & micro_os_plus::micro_test_plus::endl ( test_reporter & stream)

Definition at line 38 of file test-reporter.cpp.

◆ mut()

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

Generic mutator, to remove const from any type.

Definition at line 482 of file micro-test-plus.h.

Variable Documentation

◆ current_test_suite

test_suite_base * micro_os_plus::micro_test_plus::current_test_suite

Definition at line 205 of file micro-test-plus.cpp.

◆ reporter

test_reporter micro_os_plus::micro_test_plus::reporter

Definition at line 203 of file micro-test-plus.cpp.

◆ runner

test_runner micro_os_plus::micro_test_plus::runner

Definition at line 202 of file micro-test-plus.cpp.