micro-test-plus 6.0.0
µTest++ Testing Framework
Loading...
Searching...
No Matches
counters-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_COUNTERS_INLINES_H_
33#define MICRO_OS_PLUS_MICRO_TEST_PLUS_INLINES_COUNTERS_INLINES_H_
34
35// ----------------------------------------------------------------------------
36
37#if defined(__cplusplus)
38
39// ----------------------------------------------------------------------------
40
41#if defined(__GNUC__)
42#pragma GCC diagnostic push
43
44#if defined(__clang__)
45#pragma clang diagnostic ignored "-Wc++98-compat"
46#endif // defined(__clang__)
47#endif // defined(__GNUC__)
48
49// ============================================================================
50
52{
53 // ==========================================================================
54
59 inline void
60 counters::increment_passed_checks (size_t count) noexcept
61 {
62 passed_checks_ += count;
63 }
64
69 inline void
70 counters::increment_failed_checks (size_t count) noexcept
71 {
72 failed_checks_ += count;
73 }
74
79 inline void
81 {
82 executed_test_cases_ += count;
83 }
84
89 inline void
91 {
92 failed_test_cases_ += count;
93 }
94
99 inline void
101 {
102 skipped_test_cases_ += count;
103 }
104
109 inline size_t
110 counters::passed_checks (void) const noexcept
111 {
112 return passed_checks_;
113 }
114
115#if defined(MICRO_OS_PLUS_MICRO_TEST_PLUS_DEPRECATED_ENABLED)
120 // Deprecated since 6.0.0; use passed_checks().
121 inline size_t
122 counters::successful_checks (void) const noexcept
123 {
124 return passed_checks ();
125 }
126#endif // defined(MICRO_OS_PLUS_MICRO_TEST_PLUS_DEPRECATED_ENABLED)
127
132 inline size_t
133 counters::failed_checks (void) const noexcept
134 {
135 return failed_checks_;
136 }
137
142 inline size_t
143 counters::executed_checks (void) const noexcept
144 {
146 }
147
152 inline size_t
153 counters::executed_test_cases (void) const noexcept
154 {
156 }
157
158#if defined(MICRO_OS_PLUS_MICRO_TEST_PLUS_DEPRECATED_ENABLED)
163 // Deprecated since 6.0.0; use executed_test_cases().
164 inline size_t
165 counters::executed_subtests (void) const noexcept
166 {
167 return executed_test_cases ();
168 }
169#endif // defined(MICRO_OS_PLUS_MICRO_TEST_PLUS_DEPRECATED_ENABLED)
170
175 inline size_t
176 counters::failed_test_cases (void) const noexcept
177 {
178 return failed_test_cases_;
179 }
180
185 inline size_t
186 counters::skipped_test_cases (void) const noexcept
187 {
188 return skipped_test_cases_;
189 }
190
198 inline bool
199 counters::passed (void) const noexcept
200 {
201 return failed_checks_ == 0 && failed_test_cases_ == 0;
202 }
203
204#if defined(MICRO_OS_PLUS_MICRO_TEST_PLUS_DEPRECATED_ENABLED)
209 // Deprecated since 6.0.0; use passed().
210 inline bool
211 counters::was_successful (void) const noexcept
212 {
213 return passed ();
214 }
215#endif // defined(MICRO_OS_PLUS_MICRO_TEST_PLUS_DEPRECATED_ENABLED)
216
217 // --------------------------------------------------------------------------
218} // namespace micro_os_plus::micro_test_plus
219
220// ----------------------------------------------------------------------------
221
222#if defined(__GNUC__)
223#pragma GCC diagnostic pop
224#endif // defined(__GNUC__)
225
226// ----------------------------------------------------------------------------
227
228#endif // defined(__cplusplus)
229
230// ----------------------------------------------------------------------------
231
232#endif // MICRO_OS_PLUS_MICRO_TEST_PLUS_INLINES_COUNTERS_INLINES_H_
233
234// ----------------------------------------------------------------------------
size_t failed_test_cases_
Total number of executed test cases that failed.
Definition counters.h:506
void increment_skipped_test_cases(size_t count=1) noexcept
Increments the skipped test cases counter.
bool passed(void) const noexcept
Checks whether all executed checks and test cases were successful.
void increment_executed_test_cases(size_t count=1) noexcept
Increments the executed test cases counter.
void increment_passed_checks(size_t count=1) noexcept
Increments the passed-checks counter.
size_t successful_checks(void) const noexcept
Deprecated name of passed_checks().
size_t skipped_test_cases(void) const noexcept
Returns the number of test cases skipped by the filter.
size_t executed_subtests(void) const noexcept
Deprecated name of executed_test_cases().
size_t executed_test_cases(void) const noexcept
Returns the number of test cases that were executed.
size_t skipped_test_cases_
Total number of test cases skipped by the filter.
Definition counters.h:516
size_t passed_checks_
Total number of passed checks.
Definition counters.h:477
size_t executed_checks(void) const noexcept
Returns the total number of checks executed.
size_t passed_checks(void) const noexcept
Returns the number of checks that passed.
size_t executed_test_cases_
Total number of test cases executed.
Definition counters.h:494
void increment_failed_test_cases(size_t count=1) noexcept
Increments the failed test cases counter.
size_t failed_test_cases(void) const noexcept
Returns the number of executed test cases that failed.
size_t failed_checks_
Total number of failed checks.
Definition counters.h:485
size_t failed_checks(void) const noexcept
Returns the number of checks that failed.
void increment_failed_checks(size_t count=1) noexcept
Increments the failed-checks counter.
bool was_successful(void) const noexcept
Deprecated name of passed().
Primary namespace for the µTest++ testing framework.