Skip to main content

The test-suite-inlines.h File Reference

C++ header file with inline implementations for the µTest++ test suite. More...

Included Headers

#include <stdio.h>
#include <cstring>

Namespaces Index

namespacemicro_os_plus

The primary namespace for the µOS++ framework. More...

namespacemicro_os_plus::micro_test_plus

Primary namespace for the µTest++ testing framework. More...

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:

1/*
2 * This file is part of the µOS++ project (https://micro-os-plus.github.io/).
3 * Copyright (c) 2021 Liviu Ionescu. All rights reserved.
4 *
5 * Permission to use, copy, modify, and/or distribute this software
6 * for any purpose is hereby granted, under the terms of the MIT license.
7 *
8 * If a copy of the license was not distributed with this file, it can
10 *
11 * Major parts of the code are inspired from v1.1.8 of the Boost UT project,
12 * released under the terms of the Boost Version 1 Software License,
13 * which can be obtained from https://www.boost.org/LICENSE&#95;1&#95;0.txt.
14 */
15
16// ----------------------------------------------------------------------------
17
45
46#ifndef MICRO_TEST_PLUS_TEST_SUITE_INLINES_H_
47#define MICRO_TEST_PLUS_TEST_SUITE_INLINES_H_
48
49// ----------------------------------------------------------------------------
50
51#ifdef __cplusplus
52
53// ----------------------------------------------------------------------------
54
55#include <stdio.h>
56#include <cstring>
57// #include "test-runner.h"
58
59// ----------------------------------------------------------------------------
60
61#if defined(__GNUC__)
62#pragma GCC diagnostic push
63#pragma GCC diagnostic ignored "-Waggregate-return"
64#if defined(__clang__)
65#pragma clang diagnostic ignored "-Wc++98-compat"
66#pragma clang diagnostic ignored "-Wc++98-compat-pedantic"
67#endif
68#endif
69
71{
72 // --------------------------------------------------------------------------
73
75
76 // --------------------------------------------------------------------------
77
87 template <typename Callable_T, typename... Args_T>
88 test_suite::test_suite (const char* name, Callable_T&& callable,
89 Args_T&&... arguments)
91 callable_{ std::bind (callable, arguments...) }
92 {
93#if defined(MICRO_OS_PLUS_TRACE_MICRO_TEST_PLUS)
94 printf ("%s\n", __PRETTY_FUNCTION__);
95#endif // MICRO_OS_PLUS_TRACE_MICRO_TEST_PLUS
96
97 runner.register_test_suite (this);
98 }
99
100 // --------------------------------------------------------------------------
101} // namespace micro_os_plus::micro_test_plus
102
103#if defined(__GNUC__)
104#pragma GCC diagnostic pop
105#endif
106
107// ----------------------------------------------------------------------------
108
109#endif // __cplusplus
110
111// ----------------------------------------------------------------------------
112
113#endif // MICRO_TEST_PLUS_TEST_SUITE_INLINES_H_
114
115// ----------------------------------------------------------------------------

Generated via docusaurus-plugin-doxygen by Doxygen 1.14.0.