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#if defined(MICRO_OS_PLUS_TRACE)
59#include <micro-os-plus/diag/trace.h>
68#pragma GCC diagnostic push
69#pragma GCC diagnostic ignored "-Waggregate-return"
71#pragma clang diagnostic ignored "-Wunknown-warning-option"
72#pragma clang diagnostic ignored "-Wc++98-compat"
73#pragma clang diagnostic ignored "-Wc++98-compat-pedantic"
75#pragma GCC diagnostic ignored "-Wredundant-tags"
190 template <typename Self_T>
191 template <typename Callable_T, typename... Args_T>
194 Args_T&&... arguments)
202 if constexpr (sizeof...(arguments) == 0)
204 callable_ = std::forward<Callable_T> (callable);
208 callable_ = std::bind (std::forward<Callable_T> (callable),
209 std::placeholders::_1,
210 std::forward<Args_T> (arguments)...);
213#if defined(MICRO_OS_PLUS_TRACE) \
214 && defined(MICRO_OS_PLUS_MICRO_TEST_PLUS_TRACE_CONSTRUCTORS_ENABLED)
216#pragma GCC diagnostic push
217#if defined(__clang__)
218#pragma clang diagnostic ignored "-Wunsafe-buffer-usage-in-libc-call"
221 trace::printf ("%s '%s' %zu\n", __PRETTY_FUNCTION__, name, own_index_);
223#pragma GCC diagnostic pop
234 template <typename Self_T>
237#if defined(MICRO_OS_PLUS_TRACE) \
238 && defined(MICRO_OS_PLUS_MICRO_TEST_PLUS_TRACE_CONSTRUCTORS_ENABLED)
240#pragma GCC diagnostic push
241#if defined(__clang__)
242#pragma clang diagnostic ignored "-Wunsafe-buffer-usage-in-libc-call"
245 trace::printf ("%s '%s'\n", __PRETTY_FUNCTION__, name_);
247#pragma GCC diagnostic pop
262 template <typename Callable_T, typename... Args_T>
266 Args_T&&... arguments)
268 std::forward<Callable_T> (callable),
269 std::forward<Args_T> (arguments)... },
270 parent_suite_{ parent_suite }, nesting_depth_{ nesting_depth }
272#if defined(MICRO_OS_PLUS_TRACE) \
273 && defined(MICRO_OS_PLUS_MICRO_TEST_PLUS_TRACE_CONSTRUCTORS_ENABLED)
275#pragma GCC diagnostic push
276#if defined(__clang__)
277#pragma clang diagnostic ignored "-Wunsafe-buffer-usage-in-libc-call"
280 trace::printf ("%s '%s' %zu %zu\n", __PRETTY_FUNCTION__, name, own_index_,
283#pragma GCC diagnostic pop
294 template <typename Callable_T, typename... Args_T>
297 Args_T&&... arguments)
299#if defined(MICRO_OS_PLUS_TRACE) \
300 && defined(MICRO_OS_PLUS_MICRO_TEST_PLUS_TRACE_ENABLED)
302#pragma GCC diagnostic push
303#if defined(__clang__)
304#pragma clang diagnostic ignored "-Wunsafe-buffer-usage-in-libc-call"
307 trace::printf ("%s '%s'\n", __PRETTY_FUNCTION__, name);
309#pragma GCC diagnostic pop
314 auto child_subtest = std::make_unique<subtest> (
316 std::forward<Callable_T> (callable),
317 std::forward<Args_T> (arguments)...);
328 template <class Expr_T>
343 template <class Expr_T>
371 template <typename Callable_T, typename... Args_T>
373 Args_T&&... arguments)
375 std::forward<Args_T> (arguments)... }
377#if defined(MICRO_OS_PLUS_TRACE) \
378 && defined(MICRO_OS_PLUS_MICRO_TEST_PLUS_TRACE_CONSTRUCTORS_ENABLED)
380#pragma GCC diagnostic push
381#if defined(__clang__)
382#pragma clang diagnostic ignored "-Wunsafe-buffer-usage-in-libc-call"
385 trace::printf ("%s '%s' %zu\n", __PRETTY_FUNCTION__, name, own_index_);
387#pragma GCC diagnostic pop
393#pragma GCC diagnostic push
394#if defined(__clang__)
395#pragma clang diagnostic ignored "-Wdocumentation"
434#pragma GCC diagnostic pop
436 template <typename Callable_T, typename... Args_T>
440#if defined(MICRO_OS_PLUS_TRACE) \
441 && defined(MICRO_OS_PLUS_MICRO_TEST_PLUS_TRACE_ENABLED)
443#pragma GCC diagnostic push
444#if defined(__clang__)
445#pragma clang diagnostic ignored "-Wunsafe-buffer-usage-in-libc-call"
448 trace::printf ("%s '%s'\n", __PRETTY_FUNCTION__, name);
450#pragma GCC diagnostic pop
457 std::forward<Callable_T> (callable),
458 std::forward<Args_T> (arguments)...);
506 template <typename Callable_T, typename... Args_T>
508 Callable_T&& callable, Args_T&&... arguments)
513 if constexpr (sizeof...(arguments) == 0)
520 std::placeholders::_1,
521 std::forward<Args_T> (arguments)...);
524#if defined(MICRO_OS_PLUS_TRACE) \
525 && defined(MICRO_OS_PLUS_MICRO_TEST_PLUS_TRACE_CONSTRUCTORS_ENABLED)
527#pragma GCC diagnostic push
528#if defined(__clang__)
529#pragma clang diagnostic ignored "-Wunsafe-buffer-usage-in-libc-call"
532 trace::printf ("%s '%s' %zu\n", __PRETTY_FUNCTION__, name, own_index_);
534#pragma GCC diagnostic pop
545#pragma GCC diagnostic pop
Generated via doxygen2docusaurus 2.2.0 by Doxygen 1.17.0.