runner_totals Class
Aggregated pass/fail/subtest counters for a node in the test tree. More...
Declaration
Included Headers
Public Constructors Index
| runner_totals ()=default | |
|
Default constructor. All counters are zero-initialised. More... | |
| runner_totals (const runner_totals &)=delete | |
|
Deleted copy constructor to prevent copying. More... | |
| runner_totals (runner_totals &&)=delete | |
|
Deleted move constructor to prevent moving. More... | |
Public Operators Index
| runner_totals & | operator+= (const runner_totals &other) noexcept |
|
Accumulates the totals from another instance into this one. More... | |
| runner_totals & | operator= (const runner_totals &)=delete |
|
Deleted copy assignment operator to prevent copying. More... | |
| runner_totals & | operator= (runner_totals &&)=delete |
|
Deleted move assignment operator to prevent moving. More... | |
Public Member Functions Index
| size_t | executed_checks () const noexcept |
|
Returns the total number of checks executed. More... | |
| size_t | executed_subtests () const noexcept |
|
Returns the number of subtests that were executed. More... | |
| size_t | failed_checks () const noexcept |
|
Returns the number of checks that failed. More... | |
| void | increment_executed_subtests (size_t count=1) noexcept |
|
Increments the executed-subtests counter. More... | |
| void | increment_failed_checks (size_t count=1) noexcept |
|
Increments the failed-checks counter. More... | |
| void | increment_successful_checks (size_t count=1) noexcept |
|
Increments the successful-checks counter. More... | |
| size_t | successful_checks () const noexcept |
|
Returns the number of checks that passed. More... | |
| bool | was_successful (void) const noexcept |
|
Checks whether all executed checks were successful. More... | |
Protected Member Attributes Index
| size_t | executed_subtests_ = 0 |
|
Total number of tests executed. More... | |
| size_t | failed_checks_ = 0 |
|
Total number of failed checks. More... | |
| size_t | successful_checks_ = 0 |
|
Total number of successful checks. More... | |
Description
Aggregated pass/fail/subtest counters for a node in the test tree.
runner_totals records three counters that are maintained throughout a test session:
- the number of checks that passed (successful_checks_),
- the number of checks that failed (failed_checks_), and
- the number of subtests that were executed (executed_subtests_).
Every test_node-derived object (runner, suite, subtest) owns a runner_totals member and accumulates its counts in place. At the end of each suite or session the operator += propagates the child totals up to the parent node.
The class is non-copyable and non-movable to prevent accidental duplication of live counters.
Definition at line 88 of file runner-totals.h.
Public Constructors
runner_totals()
| default |
Default constructor. All counters are zero-initialised.
Definition at line 94 of file runner-totals.h.
Referenced by runner_totals, runner_totals, operator+=, operator= and operator=.
runner_totals()
| delete |
Deleted copy constructor to prevent copying.
Definition at line 99 of file runner-totals.h.
Reference runner_totals.
runner_totals()
| delete |
Deleted move constructor to prevent moving.
Definition at line 104 of file runner-totals.h.
Reference runner_totals.
Public Operators
operator+=()
| noexcept |
Accumulates the totals from another instance into this one.
- Parameters
-
other The instance whose totals are to be added.
- Returns
Reference to this instance.
Adds the successful check count, failed check count, and executed subtest count of other to the corresponding members of this instance. Returns a reference to *this to support chaining. When tracing is enabled, the updated totals are output for diagnostic purposes.
Declaration at line 127 of file runner-totals.h, definition at line 71 of file runner-totals.cpp.
References runner_totals, executed_subtests_, failed_checks_ and successful_checks_.
operator=()
| delete |
Deleted copy assignment operator to prevent copying.
Definition at line 110 of file runner-totals.h.
Reference runner_totals.
operator=()
| delete |
Deleted move assignment operator to prevent moving.
Definition at line 117 of file runner-totals.h.
References runner_totals, executed_checks, executed_subtests, failed_checks, increment_executed_subtests, increment_failed_checks, successful_checks and was_successful.
Public Member Functions
executed_checks()
| inline nodiscard noexcept |
Returns the total number of checks executed.
- Parameters
None.
- Returns
The sum of successful and failed checks.
Returns the sum of successful_checks_ and failed_checks_.
Declaration at line 187 of file runner-totals.h, definition at line 111 of file runner-totals-inlines.h.
References failed_checks_ and successful_checks_.
Referenced by micro_os_plus::micro_test_plus::reporter_tap::end_subtest, micro_os_plus::micro_test_plus::reporter_tap::end_suite and operator=.
executed_subtests()
| inline nodiscard noexcept |
Returns the number of subtests that were executed.
- Parameters
None.
- Returns
The cumulative count of executed subtests.
Returns the value of the executed_subtests_ counter.
Declaration at line 197 of file runner-totals.h, definition at line 121 of file runner-totals-inlines.h.
Reference executed_subtests_.
Referenced by micro_os_plus::micro_test_plus::reporter_human::end_session, micro_os_plus::micro_test_plus::reporter_tap::end_session, micro_os_plus::micro_test_plus::reporter_tap::end_subtest, micro_os_plus::micro_test_plus::reporter_human::end_suite, micro_os_plus::micro_test_plus::reporter_tap::end_suite and operator=.
failed_checks()
| inline nodiscard noexcept |
Returns the number of checks that failed.
- Parameters
None.
- Returns
The cumulative count of failed checks.
Returns the value of the failed_checks_ counter.
Declaration at line 177 of file runner-totals.h, definition at line 101 of file runner-totals-inlines.h.
Reference failed_checks_.
Referenced by micro_os_plus::micro_test_plus::reporter_human::end_session, micro_os_plus::micro_test_plus::reporter_tap::end_session, micro_os_plus::micro_test_plus::reporter_human::end_subtest, micro_os_plus::micro_test_plus::reporter_tap::end_subtest, micro_os_plus::micro_test_plus::reporter_human::end_suite, micro_os_plus::micro_test_plus::reporter_tap::end_suite and operator=.
increment_executed_subtests()
| inline noexcept |
Increments the executed-subtests counter.
- Parameters
-
count The number of subtests to add (default 1).
- Returns
Nothing.
Adds count to the executed_subtests_ counter.
Declaration at line 157 of file runner-totals.h, definition at line 81 of file runner-totals-inlines.h.
Reference executed_subtests_.
Referenced by micro_os_plus::micro_test_plus::detail::runnable_base::after_subtest_create_ and operator=.
increment_failed_checks()
| inline noexcept |
Increments the failed-checks counter.
- Parameters
-
count The number of failed checks to add (default 1).
- Returns
Nothing.
Adds count to the failed_checks_ counter.
Declaration at line 147 of file runner-totals.h, definition at line 71 of file runner-totals-inlines.h.
Reference failed_checks_.
Referenced by operator=.
increment_successful_checks()
| inline noexcept |
Increments the successful-checks counter.
- Parameters
-
count The number of successful checks to add (default 1).
- Returns
Nothing.
Adds count to the successful_checks_ counter.
Declaration at line 137 of file runner-totals.h, definition at line 61 of file runner-totals-inlines.h.
Reference successful_checks_.
successful_checks()
| inline nodiscard noexcept |
Returns the number of checks that passed.
- Parameters
None.
- Returns
The cumulative count of successful checks.
Returns the value of the successful_checks_ counter.
Declaration at line 167 of file runner-totals.h, definition at line 91 of file runner-totals-inlines.h.
Reference successful_checks_.
Referenced by micro_os_plus::micro_test_plus::reporter_human::end_session, micro_os_plus::micro_test_plus::reporter_tap::end_session, micro_os_plus::micro_test_plus::reporter_human::end_subtest, micro_os_plus::micro_test_plus::reporter_tap::end_subtest, micro_os_plus::micro_test_plus::reporter_human::end_suite, micro_os_plus::micro_test_plus::reporter_tap::end_suite and operator=.
was_successful()
| inline nodiscard noexcept |
Checks whether all executed checks were successful.
- Parameters
None.
- Return Values
-
true No checks failed.
false At least one check failed.
A runner with no checks at all is considered successful, as it did not fail any check.
Declaration at line 208 of file runner-totals.h, definition at line 132 of file runner-totals-inlines.h.
Reference failed_checks_.
Referenced by micro_os_plus::micro_test_plus::reporter_human::end_session, micro_os_plus::micro_test_plus::reporter_human::end_subtest, micro_os_plus::micro_test_plus::reporter_tap::end_subtest, micro_os_plus::micro_test_plus::reporter_human::end_suite, micro_os_plus::micro_test_plus::reporter_tap::end_suite and operator=.
Protected Member Attributes
executed_subtests_
| protected |
Total number of tests executed.
Definition at line 224 of file runner-totals.h.
Referenced by executed_subtests, increment_executed_subtests and operator+=.
failed_checks_
| protected |
Total number of failed checks.
Definition at line 219 of file runner-totals.h.
Referenced by executed_checks, failed_checks, increment_failed_checks, operator+= and was_successful.
successful_checks_
| protected |
Total number of successful checks.
Definition at line 214 of file runner-totals.h.
Referenced by executed_checks, increment_successful_checks, operator+= and successful_checks.
The documentation for this class was generated from the following files:
Generated via doxygen2docusaurus 2.2.0 by Doxygen 1.17.0.