micro-test-plus 3.2.2
µTest++ Testing Framework
Loading...
Searching...
No Matches
test-suite-inlines.h
Go to the documentation of this file.
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
9 * be obtained from https://opensource.org/licenses/mit.
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.0 Software License,
13 * which can be obtained from https://www.boost.org/LICENSE_1_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// ----------------------------------------------------------------------------
The test runner for the µTest++ framework.
Definition test-runner.h:97
test_suite_base(const char *name)
Constructs a test suite.
constexpr const char * name(void)
Gets the suite name.
Definition test-suite.h:178
std::function< void(void)> callable_
Callable object representing the test suite's execution logic.
Definition test-suite.h:438
test_suite(const char *name, Callable_T &&callable, Args_T &&... arguments)
Class template constructor for test_suite.
Primary namespace for the µTest++ testing framework.
test_runner runner
Global instance of test_runner.