C++ header file with inline implementations for the µTest++ test suite. More...
Namespaces Index
Description
C++ header file with inline implementations for the µTest++ test suite.
This header provides the inline implementations for the test suite facilities used within the µTest++ framework. It defines the logic for constructing and registering test suites, including the binding of callable objects and their arguments for flexible test suite definitions.
The implementation ensures that each test suite is automatically registered with the global test runner upon construction, enabling automated discovery and execution of test suites. The use of std::bind allows for versatile test suite initialisation with arbitrary callable types and arguments.
All definitions reside within the micro_os_plus::micro_test_plus namespace, maintaining a clear separation from user code and minimising the risk of naming conflicts.
The header files are organised within the include/micro-os-plus/micro-test-plus folder to maintain a structured and modular codebase.
This file is intended solely for internal use within the framework and should not be included directly by user code.
File Listing
The file content with the documentation metadata removed is:
46#ifndef MICRO_TEST_PLUS_TEST_INLINES_H_
47#define MICRO_TEST_PLUS_TEST_INLINES_H_
58#include <micro-os-plus/diag/trace.h>
66#pragma GCC diagnostic push
67#pragma GCC diagnostic ignored "-Waggregate-return"
69#pragma clang diagnostic ignored "-Wunknown-warning-option"
70#pragma clang diagnostic ignored "-Wc++98-compat"
71#pragma clang diagnostic ignored "-Wc++98-compat-pedantic"
73#pragma GCC diagnostic ignored "-Wredundant-tags"
188 template <typename Self_T>
189 template <typename Callable_T, typename... Args_T>
192 Args_T&&... arguments)
200 if constexpr (sizeof...(arguments) == 0)
202 callable_ = std::forward<Callable_T> (callable);
206 callable_ = std::bind (std::forward<Callable_T> (callable),
207 std::placeholders::_1,
208 std::forward<Args_T> (arguments)...);
211#if defined(MICRO_OS_PLUS_MICRO_TEST_PLUS_TRACE_CONSTRUCTORS_ENABLED)
213#pragma GCC diagnostic push
214#if defined(__clang__)
215#pragma clang diagnostic ignored "-Wunsafe-buffer-usage-in-libc-call"
218 trace::printf ("%s '%s' %zu\n", __PRETTY_FUNCTION__, name, own_index_);
220#pragma GCC diagnostic pop
231 template <typename Self_T>
234#if defined(MICRO_OS_PLUS_MICRO_TEST_PLUS_TRACE_CONSTRUCTORS_ENABLED)
236#pragma GCC diagnostic push
237#if defined(__clang__)
238#pragma clang diagnostic ignored "-Wunsafe-buffer-usage-in-libc-call"
241 trace::printf ("%s '%s'\n", __PRETTY_FUNCTION__, name_);
243#pragma GCC diagnostic pop
258 template <typename Callable_T, typename... Args_T>
262 Args_T&&... arguments)
264 std::forward<Callable_T> (callable),
265 std::forward<Args_T> (arguments)... },
266 parent_suite_{ parent_suite }, nesting_depth_{ nesting_depth }
268#if defined(MICRO_OS_PLUS_MICRO_TEST_PLUS_TRACE_CONSTRUCTORS_ENABLED)
270#pragma GCC diagnostic push
271#if defined(__clang__)
272#pragma clang diagnostic ignored "-Wunsafe-buffer-usage-in-libc-call"
275 trace::printf ("%s '%s' %zu %zu\n", __PRETTY_FUNCTION__, name, own_index_,
278#pragma GCC diagnostic pop
289 template <typename Callable_T, typename... Args_T>
292 Args_T&&... arguments)
294#if defined(MICRO_OS_PLUS_MICRO_TEST_PLUS_TRACE_ENABLED)
296#pragma GCC diagnostic push
297#if defined(__clang__)
298#pragma clang diagnostic ignored "-Wunsafe-buffer-usage-in-libc-call"
301 trace::printf ("%s '%s'\n", __PRETTY_FUNCTION__, name);
303#pragma GCC diagnostic pop
308 auto child_subtest = std::make_unique<subtest> (
310 std::forward<Callable_T> (callable),
311 std::forward<Args_T> (arguments)...);
322 template <class Expr_T>
337 template <class Expr_T>
365 template <typename Callable_T, typename... Args_T>
367 Args_T&&... arguments)
369 std::forward<Args_T> (arguments)... }
371#if defined(MICRO_OS_PLUS_MICRO_TEST_PLUS_TRACE_CONSTRUCTORS_ENABLED)
373#pragma GCC diagnostic push
374#if defined(__clang__)
375#pragma clang diagnostic ignored "-Wunsafe-buffer-usage-in-libc-call"
378 trace::printf ("%s '%s' %zu\n", __PRETTY_FUNCTION__, name, own_index_);
380#pragma GCC diagnostic pop
386#pragma GCC diagnostic push
387#if defined(__clang__)
388#pragma clang diagnostic ignored "-Wdocumentation"
427#pragma GCC diagnostic pop
429 template <typename Callable_T, typename... Args_T>
433#if defined(MICRO_OS_PLUS_MICRO_TEST_PLUS_TRACE_ENABLED)
435#pragma GCC diagnostic push
436#if defined(__clang__)
437#pragma clang diagnostic ignored "-Wunsafe-buffer-usage-in-libc-call"
440 trace::printf ("%s '%s'\n", __PRETTY_FUNCTION__, name);
442#pragma GCC diagnostic pop
449 std::forward<Callable_T> (callable),
450 std::forward<Args_T> (arguments)...);
498 template <typename Callable_T, typename... Args_T>
500 Callable_T&& callable, Args_T&&... arguments)
505 if constexpr (sizeof...(arguments) == 0)
512 std::placeholders::_1,
513 std::forward<Args_T> (arguments)...);
516#if defined(MICRO_OS_PLUS_MICRO_TEST_PLUS_TRACE_CONSTRUCTORS_ENABLED)
518#pragma GCC diagnostic push
519#if defined(__clang__)
520#pragma clang diagnostic ignored "-Wunsafe-buffer-usage-in-libc-call"
523 trace::printf ("%s '%s' %zu\n", __PRETTY_FUNCTION__, name, own_index_);
525#pragma GCC diagnostic pop
536#pragma GCC diagnostic pop
Generated via doxygen2docusaurus 2.2.1 by Doxygen 1.17.0.