micro-test-plus 4.1.0
µTest++ Testing Framework
Loading...
Searching...
No Matches
runner-totals-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 * 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
33
34#ifndef MICRO_TEST_PLUS_RUNNER_TOTALS_INLINES_H_
35#define MICRO_TEST_PLUS_RUNNER_TOTALS_INLINES_H_
36
37// ----------------------------------------------------------------------------
38
39#ifdef __cplusplus
40
41// ----------------------------------------------------------------------------
42
43#if defined(__GNUC__)
44#pragma GCC diagnostic push
45#if defined(__clang__)
46#pragma clang diagnostic ignored "-Wc++98-compat"
47#endif
48#endif
49
50// ============================================================================
51
53{
54 // ==========================================================================
55
60 inline void
62 {
63 successful_checks_ += count;
64 }
65
70 inline void
72 {
73 failed_checks_ += count;
74 }
75
80 inline void
82 {
83 executed_subtests_ += count;
84 }
85
90 inline size_t
92 {
93 return successful_checks_;
94 }
95
100 inline size_t
102 {
103 return failed_checks_;
104 }
105
110 inline size_t
112 {
114 }
115
120 inline size_t
122 {
123 return executed_subtests_;
124 }
125
131 inline bool
132 runner_totals::was_successful (void) const noexcept
133 {
134 return failed_checks_ == 0;
135 }
136
137 // --------------------------------------------------------------------------
138} // namespace micro_os_plus::micro_test_plus::detail
139
140#if defined(__GNUC__)
141#pragma GCC diagnostic pop
142#endif
143
144// ----------------------------------------------------------------------------
145
146#endif // __cplusplus
147
148// ----------------------------------------------------------------------------
149
150#endif // MICRO_TEST_PLUS_RUNNER_TOTALS_INLINES_H_
151
152// ----------------------------------------------------------------------------
void increment_successful_checks(size_t count=1) noexcept
Increments the successful-checks counter.
size_t successful_checks_
Total number of successful checks.
size_t executed_subtests() const noexcept
Returns the number of subtests that were executed.
size_t successful_checks() const noexcept
Returns the number of checks that passed.
bool was_successful(void) const noexcept
Checks whether all executed checks were successful.
void increment_executed_subtests(size_t count=1) noexcept
Increments the executed-subtests counter.
size_t failed_checks_
Total number of failed checks.
size_t executed_subtests_
Total number of tests executed.
void increment_failed_checks(size_t count=1) noexcept
Increments the failed-checks counter.
size_t failed_checks() const noexcept
Returns the number of checks that failed.
size_t executed_checks() const noexcept
Returns the total number of checks executed.
Internal implementation details for the µTest++ framework.