micro-test-plus 6.0.0
µTest++ Testing Framework
Loading...
Searching...
No Matches
runner-options-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-2026 Liviu Ionescu. All rights reserved.
4 *
5 * Permission to use, copy, modify, and/or distribute this software for any
6 * 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 be
9 * obtained from https://opensource.org/licenses/mit.
10 */
11
12// ----------------------------------------------------------------------------
13
31
32#ifndef MICRO_OS_PLUS_MICRO_TEST_PLUS_INLINES_RUNNER_OPTIONS_INLINES_H_
33#define MICRO_OS_PLUS_MICRO_TEST_PLUS_INLINES_RUNNER_OPTIONS_INLINES_H_
34
35// ----------------------------------------------------------------------------
36
37#if defined(__cplusplus)
38
39// ----------------------------------------------------------------------------
40
41#if defined(__GNUC__)
42#pragma GCC diagnostic push
43
44#pragma GCC diagnostic ignored "-Waggregate-return"
45#if defined(__clang__)
46#pragma clang diagnostic ignored "-Wc++98-compat"
47#endif // defined(__clang__)
48#endif // defined(__GNUC__)
49
50// ============================================================================
51
53{
54 // ==========================================================================
55
61 inline runner_options&
63 {
64 runner_options copy{ other };
65 *this = std::move (copy);
66 return *this;
67 }
68
73 inline bool
74 runner_options::has_errors (void) const noexcept
75 {
76 return !errors_.empty ();
77 }
78
83 inline bool
85 {
86 return unknown_option_;
87 }
88
93 inline const std::vector<std::string>&
94 runner_options::errors (void) const noexcept
95 {
96 return errors_;
97 }
98
104 inline const std::vector<std::string>&
105 runner_options::arguments (void) const noexcept
106 {
107 return arguments_;
108 }
109
116 inline std::span<const std::string>
118 {
119 if (application_begin_ >= arguments_.size ())
120 {
121 return {};
122 }
123
124 return std::span<const std::string>{ arguments_ }.subspan (
126 }
127
128 // --------------------------------------------------------------------------
129} // namespace micro_os_plus::micro_test_plus
130
131// ----------------------------------------------------------------------------
132
133#if defined(__GNUC__)
134#pragma GCC diagnostic pop
135#endif // defined(__GNUC__)
136
137// ----------------------------------------------------------------------------
138
139#endif // defined(__cplusplus)
140
141// ----------------------------------------------------------------------------
142
143#endif // MICRO_OS_PLUS_MICRO_TEST_PLUS_INLINES_RUNNER_OPTIONS_INLINES_H_
144
145// ----------------------------------------------------------------------------
The configuration of a test session, and its command-line parser.
std::size_t application_begin_
The index in arguments_ of the first argument left to the application.
bool has_unknown_option(void) const noexcept
Checks whether an unknown option was found while parsing the command line.
runner_options(void)=default
Constructs the default options.
std::vector< std::string > errors_
The errors found while parsing the command line.
const std::vector< std::string > & errors(void) const noexcept
Returns the errors found while parsing the command line.
bool has_errors(void) const noexcept
Checks whether errors were found while parsing the command line.
bool unknown_option_
Whether an unknown option was found.
runner_options & operator=(const runner_options &other)
Copy assignment operator.
const std::vector< std::string > & arguments(void) const noexcept
Returns the complete command line, including argv[0], if any.
std::span< const std::string > application_arguments(void) const noexcept
Returns the arguments left to the application.
std::vector< std::string > arguments_
The complete command line, including argv[0], if any.
Primary namespace for the µTest++ testing framework.