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

Main C++ header with the declarations for the µTest++ Testing Framework. More...

Go to the source code of this file.

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::utility
 Utility functions for the µTest++ testing framework.

Functions

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 micro_os_plus::micro_test_plus::assume (const Expr_T &expr, const reflection::source_location &sl=reflection::source_location::current())
 Check a condition and, if false, abort test execution.
int micro_os_plus::micro_test_plus::exit_code (void)
 Complete the test run 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 micro_os_plus::micro_test_plus::expect (const Expr_T &expr, const reflection::source_location &sl=reflection::source_location::current())
 Evaluate a generic condition and report the results.
void micro_os_plus::micro_test_plus::initialize (int argc, char *argv[], const char *name="Main")
 Initialise the µTest++ framework.
bool micro_os_plus::micro_test_plus::utility::is_match (std::string_view input, std::string_view pattern)
 Check if a string matches a pattern.
template<class Callable_T>
constexpr auto micro_os_plus::micro_test_plus::nothrow (const Callable_T &func)
 Check if a callable does not throw an exception.
template<class T, class Delim_T>
auto micro_os_plus::micro_test_plus::utility::split (T input, Delim_T delim) -> std::vector< T >
 Split a string into a vector of sub-strings.
template<typename Callable_T, typename... Args_T>
void micro_os_plus::micro_test_plus::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 micro_os_plus::micro_test_plus::throws (const Callable_T &func)
 Check if a callable throws a specific exception.
template<class Callable_T>
constexpr auto micro_os_plus::micro_test_plus::throws (const Callable_T &func)
 Check if a callable throws an exception (any exception).

Variables

test_suite_basemicro_os_plus::micro_test_plus::current_test_suite
 Global pointer references the currently active test suite.
test_reporter micro_os_plus::micro_test_plus::reporter
 Global instance of test_reporter.
test_runner micro_os_plus::micro_test_plus::runner
 Global instance of test_runner.

Detailed Description

This header serves as the principal entry point for the µTest++ testing framework, purpose-built for both embedded and general C++ projects.

It provides all essential declarations required to write and manage tests, including test runner and reporter objects, test suite and test case management, expectations, assumptions, comparators, logical operators, exception verification, and utility functions.

The header also incorporates all necessary dependencies and internal headers to ensure the framework operates correctly and efficiently.

All public API definitions reside within the micro_os_plus::micro_test_plus namespace and its nested namespaces, ensuring clear separation from user code and minimising the risk of naming conflicts.

This file is located in the top-level include/micro-os-plus directory; all other header files are organised within the include/micro-os-plus/micro-test-plus directory to maintain a structured and modular codebase.

To access the complete functionality of the µTest++ framework, users should include this header in their test projects.

The implementation is significantly inspired by Boost UT, with adaptations and extensions to address the requirements of embedded development and the µTest++ framework.

Definition in file micro-test-plus.h.