Skip to main content

The test-runner.h File Reference

C++ header file with declarations for the µTest++ test runner. More...

Included Headers

#include <functional>

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...

Classes Index

classtest_runner

The test runner for the µTest++ framework. More...

Description

C++ header file with declarations for the µTest++ test runner.

This header provides the declarations for the test runner facilities used within the µTest++ framework. It defines the interface for managing the registration and execution of test suites, supporting automated discovery and orchestration of tests across a project.

The test runner is responsible for initialising the test environment, registering test suites, managing command-line arguments, and determining the overall test result via an exit code. It also provides mechanisms for aborting test execution and retrieving the default suite name.

All definitions reside within the micro_os_plus::micro_test_plus namespace, ensuring 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
44
45#ifndef MICRO_TEST_PLUS_TEST_RUNNER_H_
46#define MICRO_TEST_PLUS_TEST_RUNNER_H_
47
48// ----------------------------------------------------------------------------
49
50#ifdef __cplusplus
51
52// ----------------------------------------------------------------------------
53
54#include <functional>
55
56// ----------------------------------------------------------------------------
57
58#if defined(__GNUC__)
59#pragma GCC diagnostic push
60#pragma GCC diagnostic ignored "-Wpadded"
61#if defined(__clang__)
62#pragma clang diagnostic ignored "-Wc++98-compat"
63#endif
64#endif
65
67{
68 // --------------------------------------------------------------------------
69
70 // Forward definition.
71 class test_suite_base;
72
73 // --------------------------------------------------------------------------
74
97 {
98 public:
105 test_runner ();
106
110 test_runner (const test_runner&) = delete;
111
116
122 = delete;
123
129 = delete;
130
134 ~test_runner () = default;
135
146 void
147 initialize (int argc, char* argv[], const char* name);
148
156 int
157 exit_code (void);
158
166 void
168
177 constexpr const char*
178 name (void)
179 {
181 }
182
191 [[noreturn]] void
192 abort (void);
193
194 protected:
198 int argc_ = 0;
199
203 char** argv_ = nullptr;
204
208 const char* default_suite_name_ = "Test";
209
214
223 std::vector<test_suite_base*>* suites_;
224 };
225
226 // --------------------------------------------------------------------------
227} // namespace micro_os_plus::micro_test_plus
228
229#if defined(__GNUC__)
230#pragma GCC diagnostic pop
231#endif
232
233// ----------------------------------------------------------------------------
234
235#endif // __cplusplus
236
237// ----------------------------------------------------------------------------
238
239#endif // MICRO_TEST_PLUS_TEST_RUNNER_H_
240
241// ----------------------------------------------------------------------------

Generated via docusaurus-plugin-doxygen by Doxygen 1.14.0.