micro-test-plus 5.0.0
µTest++ Testing Framework
Loading...
Searching...
No Matches
runner-totals.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 * 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
34
35// ----------------------------------------------------------------------------
36
37#if __has_include(<micro-os-plus/project-config.h>)
38#include <micro-os-plus/project-config.h>
39#elif __has_include(<micro-os-plus/config.h>)
40#pragma message \
41 "micro-os-plus/config.h is deprecated, rename to micro-os-plus/project-config.h and include it instead of micro-os-plus/config.h"
42#include <micro-os-plus/config.h>
43#endif // __has_include(<micro-os-plus/project-config.h>)
44
45#if __has_include(<micro-os-plus/micro-test-plus-defines.h>)
46#include <micro-os-plus/micro-test-plus-defines.h>
47#endif // __has_include(<micro-os-plus/micro-test-plus-defines.h>)
48
49#include <micro-os-plus/diag/trace.h>
50
52
53// ----------------------------------------------------------------------------
54
55#if defined(__GNUC__)
56#if defined(__clang__)
57#pragma clang diagnostic ignored "-Wunknown-warning-option"
58#pragma clang diagnostic ignored "-Wc++98-compat"
59#pragma clang diagnostic ignored "-Wpre-c++17-compat"
60#endif
61#endif
62
63// ============================================================================
64
66{
67 // ===========================================================================
68
79 {
80 successful_checks_ += other.successful_checks ();
81 failed_checks_ += other.failed_checks ();
82 executed_subtests_ += other.executed_subtests ();
83
84#if defined(MICRO_OS_PLUS_MICRO_TEST_PLUS_TRACE_ENABLED)
85#if defined(__GNUC__)
86#pragma GCC diagnostic push
87#if defined(__clang__)
88#pragma clang diagnostic ignored "-Wunsafe-buffer-usage-in-libc-call"
89#endif
90#endif
91 trace::printf ("%s -> +%zu -%zu in xs%zu\n", __PRETTY_FUNCTION__,
93#if defined(__GNUC__)
94#pragma GCC diagnostic pop
95#endif
96#endif // MICRO_OS_PLUS_MICRO_TEST_PLUS_TRACE_ENABLED
97
98 return *this;
99 }
100
101 // --------------------------------------------------------------------------
102} // namespace micro_os_plus::micro_test_plus::detail
103
104// ----------------------------------------------------------------------------
Aggregated pass/fail/subtest counters for a node in the test tree.
size_t successful_checks_
Total number of successful checks.
runner_totals & operator+=(const runner_totals &other) noexcept
Accumulates the totals from another instance into this one.
size_t failed_checks_
Total number of failed checks.
size_t executed_subtests_
Total number of tests executed.
runner_totals()=default
Default constructor. All counters are zero-initialised.
Internal implementation details for the µTest++ framework.
C++ header file with declarations for the µTest++ runner totals.