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 "-Wc++98-compat"
72#pragma clang diagnostic ignored "-Wc++98-compat-pedantic"
74#pragma GCC diagnostic ignored "-Wredundant-tags"
189 template <typename Self_T>
190 template <typename Callable_T, typename... Args_T>
193 Args_T&&... arguments)
201 if constexpr (sizeof...(arguments) == 0)
203 callable_ = std::forward<Callable_T> (callable);
207 callable_ = std::bind (std::forward<Callable_T> (callable),
208 std::placeholders::_1,
209 std::forward<Args_T> (arguments)...);
212#if defined(MICRO_OS_PLUS_TRACE) \
213 && defined(MICRO_OS_PLUS_TRACE_MICRO_TEST_PLUS_CONSTRUCTORS)
215#pragma GCC diagnostic push
216#if defined(__clang__)
217#pragma clang diagnostic ignored "-Wunsafe-buffer-usage-in-libc-call"
220 trace::printf ("%s '%s' %zu\n", __PRETTY_FUNCTION__, name, own_index_);
222#pragma GCC diagnostic pop
233 template <typename Self_T>
236#if defined(MICRO_OS_PLUS_TRACE) \
237 && defined(MICRO_OS_PLUS_TRACE_MICRO_TEST_PLUS_CONSTRUCTORS)
239#pragma GCC diagnostic push
240#if defined(__clang__)
241#pragma clang diagnostic ignored "-Wunsafe-buffer-usage-in-libc-call"
244 trace::printf ("%s '%s'\n", __PRETTY_FUNCTION__, name_);
246#pragma GCC diagnostic pop
261 template <typename Callable_T, typename... Args_T>
265 Args_T&&... arguments)
267 std::forward<Callable_T> (callable),
268 std::forward<Args_T> (arguments)... },
269 parent_suite_{ parent_suite }, nesting_depth_{ nesting_depth }
271#if defined(MICRO_OS_PLUS_TRACE) \
272 && defined(MICRO_OS_PLUS_TRACE_MICRO_TEST_PLUS_CONSTRUCTORS)
274#pragma GCC diagnostic push
275#if defined(__clang__)
276#pragma clang diagnostic ignored "-Wunsafe-buffer-usage-in-libc-call"
279 trace::printf ("%s '%s' %zu %zu\n", __PRETTY_FUNCTION__, name, own_index_,
282#pragma GCC diagnostic pop
293 template <typename Callable_T, typename... Args_T>
296 Args_T&&... arguments)
298#if defined(MICRO_OS_PLUS_TRACE) \
299 && defined(MICRO_OS_PLUS_TRACE_MICRO_TEST_PLUS)
301#pragma GCC diagnostic push
302#if defined(__clang__)
303#pragma clang diagnostic ignored "-Wunsafe-buffer-usage-in-libc-call"
306 trace::printf ("%s '%s'\n", __PRETTY_FUNCTION__, name);
308#pragma GCC diagnostic pop
313 auto child_subtest = std::make_unique<subtest> (
315 std::forward<Callable_T> (callable),
316 std::forward<Args_T> (arguments)...);
327 template <class Expr_T>
342 template <class Expr_T>
370 template <typename Callable_T, typename... Args_T>
372 Args_T&&... arguments)
374 std::forward<Args_T> (arguments)... }
376#if defined(MICRO_OS_PLUS_TRACE) \
377 && defined(MICRO_OS_PLUS_TRACE_MICRO_TEST_PLUS_CONSTRUCTORS)
379#pragma GCC diagnostic push
380#if defined(__clang__)
381#pragma clang diagnostic ignored "-Wunsafe-buffer-usage-in-libc-call"
384 trace::printf ("%s '%s' %zu\n", __PRETTY_FUNCTION__, name, own_index_);
386#pragma GCC diagnostic pop
392#pragma GCC diagnostic push
393#if defined(__clang__)
394#pragma clang diagnostic ignored "-Wdocumentation"
433#pragma GCC diagnostic pop
435 template <typename Callable_T, typename... Args_T>
439#if defined(MICRO_OS_PLUS_TRACE) \
440 && defined(MICRO_OS_PLUS_TRACE_MICRO_TEST_PLUS)
442#pragma GCC diagnostic push
443#if defined(__clang__)
444#pragma clang diagnostic ignored "-Wunsafe-buffer-usage-in-libc-call"
447 trace::printf ("%s '%s'\n", __PRETTY_FUNCTION__, name);
449#pragma GCC diagnostic pop
456 std::forward<Callable_T> (callable),
457 std::forward<Args_T> (arguments)...);
505 template <typename Callable_T, typename... Args_T>
507 Callable_T&& callable, Args_T&&... arguments)
512 if constexpr (sizeof...(arguments) == 0)
519 std::placeholders::_1,
520 std::forward<Args_T> (arguments)...);
523#if defined(MICRO_OS_PLUS_TRACE) \
524 && defined(MICRO_OS_PLUS_TRACE_MICRO_TEST_PLUS_CONSTRUCTORS)
526#pragma GCC diagnostic push
527#if defined(__clang__)
528#pragma clang diagnostic ignored "-Wunsafe-buffer-usage-in-libc-call"
531 trace::printf ("%s '%s' %zu\n", __PRETTY_FUNCTION__, name, own_index_);
533#pragma GCC diagnostic pop
544#pragma GCC diagnostic pop
Generated via doxygen2docusaurus 2.2.0 by Doxygen 1.17.0.