Skip to main content

counters.cpp File

C++ source file with implementations for the µTest++ counters member functions. More...

Included Headers​

Namespaces Index​

namespacemicro_os_plus

The primary namespace for the µOS++ framework. More...

namespacemicro_test_plus

Primary namespace for the µTest++ testing framework. More...

Description​

C++ source file with implementations for the µTest++ counters member functions.

This source file contains the implementation of the counters::operator+= member function, which aggregates test result counters from one counters instance into another. It accumulates passed checks, failed checks, and the executed, failed, and skipped test cases.

All definitions reside within the micro_os_plus::micro_test_plus namespace.

This file must be included when building the µTest++ library.

File Listing​

The file content with the documentation metadata removed is:

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// ----------------------------------------------------------------------------

Generated via doxygen2docusaurus 2.2.8 by Doxygen 1.18.0.