micro-test-plus
5.0.1
µTest++ Testing Framework
Toggle main menu visibility
Loading...
Searching...
No Matches
runner-totals.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
* 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
36
37
#ifndef MICRO_OS_PLUS_MICRO_TEST_PLUS_TEST_RUNNER_TOTALS_H_
38
#define MICRO_OS_PLUS_MICRO_TEST_PLUS_TEST_RUNNER_TOTALS_H_
39
40
// ----------------------------------------------------------------------------
41
42
#if defined(__cplusplus)
43
44
// ----------------------------------------------------------------------------
45
46
#if __has_include("micro-os-plus/project-config.h")
47
#include "micro-os-plus/project-config.h"
48
#endif
// __has_include("micro-os-plus/project-config.h")
49
50
#if __has_include("micro-os-plus/micro-test-plus-defines.h")
51
#include "micro-os-plus/micro-test-plus-defines.h"
52
#endif
// __has_include("micro-os-plus/micro-test-plus-defines.h")
53
54
#include <cstddef>
55
56
// ----------------------------------------------------------------------------
57
58
#if defined(__GNUC__)
59
#pragma GCC diagnostic push
60
61
#if defined(__clang__)
62
#pragma clang diagnostic ignored "-Wc++98-compat"
63
#endif
// defined(__clang__)
64
#endif
// defined(__GNUC__)
65
66
// ============================================================================
67
68
namespace
micro_os_plus::micro_test_plus
69
{
70
// --------------------------------------------------------------------------
71
72
namespace
detail
73
{
74
// ========================================================================
75
97
class
runner_totals
98
{
99
public
:
103
runner_totals
() =
default
;
104
108
runner_totals
(
const
runner_totals
&) =
delete
;
109
113
runner_totals
(
runner_totals
&&) =
delete
;
114
118
runner_totals
&
119
operator=
(
const
runner_totals
&)
120
=
delete
;
121
125
runner_totals
&
126
operator=
(
runner_totals
&&)
127
=
delete
;
128
135
runner_totals
&
136
operator+=
(
const
runner_totals
& other)
noexcept
;
137
145
void
146
increment_successful_checks
(
size_t
count = 1) noexcept;
147
155
void
156
increment_failed_checks
(
size_t
count = 1) noexcept;
157
165
void
166
increment_executed_subtests
(
size_t
count = 1) noexcept;
167
175
[[nodiscard]]
size_t
176
successful_checks
() const noexcept;
177
185
[[nodiscard]]
size_t
186
failed_checks
() const noexcept;
187
195
[[nodiscard]]
size_t
196
executed_checks
() const noexcept;
197
205
[[nodiscard]]
size_t
206
executed_subtests
() const noexcept;
207
216
[[nodiscard]]
bool
217
was_successful
(
void
) const noexcept;
218
219
protected:
223
size_t
successful_checks_
= 0;
224
228
size_t
failed_checks_
= 0;
229
233
size_t
executed_subtests_
= 0;
234
};
235
236
// ------------------------------------------------------------------------
237
}
// namespace detail
238
239
// --------------------------------------------------------------------------
240
}
// namespace micro_os_plus::micro_test_plus
241
242
#if defined(__GNUC__)
243
#pragma GCC diagnostic pop
244
#endif
// defined(__GNUC__)
245
246
// ----------------------------------------------------------------------------
247
248
#endif
// defined(__cplusplus)
249
250
// ============================================================================
251
// Templates, inlines & constexpr implementations.
252
253
#include "
inlines/runner-totals-inlines.h
"
254
255
// ----------------------------------------------------------------------------
256
257
#endif
// MICRO_OS_PLUS_MICRO_TEST_PLUS_TEST_RUNNER_TOTALS_H_
258
259
// ----------------------------------------------------------------------------
micro_os_plus::micro_test_plus::detail::runner_totals::increment_successful_checks
void increment_successful_checks(size_t count=1) noexcept
Increments the successful-checks counter.
Definition
runner-totals-inlines.h:62
micro_os_plus::micro_test_plus::detail::runner_totals::successful_checks_
size_t successful_checks_
Total number of successful checks.
Definition
runner-totals.h:223
micro_os_plus::micro_test_plus::detail::runner_totals::executed_subtests
size_t executed_subtests() const noexcept
Returns the number of subtests that were executed.
Definition
runner-totals-inlines.h:122
micro_os_plus::micro_test_plus::detail::runner_totals::operator+=
runner_totals & operator+=(const runner_totals &other) noexcept
Accumulates the totals from another instance into this one.
Definition
runner-totals.cpp:73
micro_os_plus::micro_test_plus::detail::runner_totals::runner_totals
runner_totals(const runner_totals &)=delete
Deleted copy constructor to prevent copying.
micro_os_plus::micro_test_plus::detail::runner_totals::runner_totals
runner_totals(runner_totals &&)=delete
Deleted move constructor to prevent moving.
micro_os_plus::micro_test_plus::detail::runner_totals::successful_checks
size_t successful_checks() const noexcept
Returns the number of checks that passed.
Definition
runner-totals-inlines.h:92
micro_os_plus::micro_test_plus::detail::runner_totals::was_successful
bool was_successful(void) const noexcept
Checks whether all executed checks were successful.
Definition
runner-totals-inlines.h:133
micro_os_plus::micro_test_plus::detail::runner_totals::increment_executed_subtests
void increment_executed_subtests(size_t count=1) noexcept
Increments the executed-subtests counter.
Definition
runner-totals-inlines.h:82
micro_os_plus::micro_test_plus::detail::runner_totals::failed_checks_
size_t failed_checks_
Total number of failed checks.
Definition
runner-totals.h:228
micro_os_plus::micro_test_plus::detail::runner_totals::executed_subtests_
size_t executed_subtests_
Total number of tests executed.
Definition
runner-totals.h:233
micro_os_plus::micro_test_plus::detail::runner_totals::increment_failed_checks
void increment_failed_checks(size_t count=1) noexcept
Increments the failed-checks counter.
Definition
runner-totals-inlines.h:72
micro_os_plus::micro_test_plus::detail::runner_totals::failed_checks
size_t failed_checks() const noexcept
Returns the number of checks that failed.
Definition
runner-totals-inlines.h:102
micro_os_plus::micro_test_plus::detail::runner_totals::runner_totals
runner_totals()=default
Default constructor. All counters are zero-initialised.
micro_os_plus::micro_test_plus::detail::runner_totals::operator=
runner_totals & operator=(const runner_totals &)=delete
Deleted copy assignment operator to prevent copying.
micro_os_plus::micro_test_plus::detail::runner_totals::executed_checks
size_t executed_checks() const noexcept
Returns the total number of checks executed.
Definition
runner-totals-inlines.h:112
micro_os_plus::micro_test_plus::detail
Internal implementation details for the µTest++ framework.
Definition
deferred-reporter.h:88
micro_os_plus::micro_test_plus
Primary namespace for the µTest++ testing framework.
Definition
deferred-reporter.h:82
runner-totals-inlines.h
C++ header file with inline implementations for the µTest++ runner totals.
include
micro-os-plus
micro-test-plus
runner-totals.h
Generated by
1.17.0