micro-test-plus 6.0.0
µTest++ Testing Framework
Loading...
Searching...
No Matches
counters.cpp
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// ----------------------------------------------------------------------------
33
36
37#if __has_include("micro-os-plus/diag/trace.h")
38#include "micro-os-plus/diag/trace.h"
39#endif // __has_include("micro-os-plus/diag/trace.h")
40
41// ----------------------------------------------------------------------------
42
43#if defined(__GNUC__)
44#if defined(__clang__)
45#pragma clang diagnostic ignored "-Wunknown-warning-option"
46#pragma clang diagnostic ignored "-Wc++98-compat"
47#pragma clang diagnostic ignored "-Wpre-c++17-compat"
48#pragma clang diagnostic ignored "-Wunsafe-buffer-usage-in-libc-call"
49#endif // defined(__clang__)
50#endif // defined(__GNUC__)
51
52// ============================================================================
53
54#if defined(MICRO_OS_PLUS_MICRO_TEST_PLUS_ENABLED)
55
56// ----------------------------------------------------------------------------
57
59{
60 // ==========================================================================
61
71 counters::operator+= (const counters& other) noexcept
72 {
73 passed_checks_ += other.passed_checks ();
74 failed_checks_ += other.failed_checks ();
75 executed_test_cases_ += other.executed_test_cases ();
76 failed_test_cases_ += other.failed_test_cases ();
77 skipped_test_cases_ += other.skipped_test_cases ();
78
79#if defined(MICRO_OS_PLUS_MICRO_TEST_PLUS_TRACE_ENABLED)
80 trace::printf ("%s -> +%" MICRO_OS_PLUS_MICRO_TEST_PLUS_PRI_SIZE
84 __PRETTY_FUNCTION__, passed_checks_, failed_checks_,
86#endif // MICRO_OS_PLUS_MICRO_TEST_PLUS_TRACE_ENABLED
87
88 return *this;
89 }
90
91 // --------------------------------------------------------------------------
92} // namespace micro_os_plus::micro_test_plus
93
94// ----------------------------------------------------------------------------
95
96#endif // defined(MICRO_OS_PLUS_MICRO_TEST_PLUS_ENABLED)
97
98// ----------------------------------------------------------------------------
Aggregated check and test case counters for a node in the test tree.
Definition counters.h:123
size_t failed_test_cases_
Total number of executed test cases that failed.
Definition counters.h:506
counters(void)=default
Default constructor.
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_test_cases_
Total number of test cases executed.
Definition counters.h:494
size_t failed_checks_
Total number of failed checks.
Definition counters.h:485
counters & operator+=(const counters &other) noexcept
Accumulates the totals from another instance into this one.
Definition counters.cpp:71
C++ header file with declarations for the µTest++ counters.
C++ header file with declarations for the µTest++ internals.
#define MICRO_OS_PLUS_MICRO_TEST_PLUS_PRI_SIZE
Portable printf() conversion for the size_t values.
Definition detail.h:102
Primary namespace for the µTest++ testing framework.