Skip to main content

test_node Class

Base class for runners and runable tests. More...

Declaration

class micro_os_plus::micro_test_plus::detail::test_node { ... }

Included Headers

Derived Classes

classrunnable_base

Non-template base for all runnable objects (suites and subtests). More...

classrunner

The test runner for the µTest++ framework. More...

Public Constructors Index

test_node (const char *name)

Constructs a test node. More...

test_node (const test_node &)=delete

Deleted copy constructor to prevent copying. More...

test_node (test_node &&)=delete

Deleted move constructor to prevent moving. More...

Public Destructor Index

~test_node ()

Virtual destructor for the test_node class. More...

Public Operators Index

test_node &operator= (const test_node &)=delete

Deleted copy assignment operator to prevent copying. More...

test_node &operator= (test_node &&)=delete

Deleted move assignment operator to prevent moving. More...

Public Member Functions Index

const char *name (void) const noexcept

Gets the node name. More...

const runner_totals &totals () const noexcept

Gets the totals for the test (const overload). More...

runner_totals &totals () noexcept

Gets the totals for the test. More...

Protected Member Attributes Index

const char *name_

The test node name. More...

runner_totalstotals_

Totals for the test node, including nested cases. More...

Description

Base class for runners and runable tests.

The test_node class provides the foundational interface for managing test within the µTest++ framework. It maintains counters for successful and failed checks, tracks test cases, and offers methods for marking the commencement and completion of test cases and suites.

This class ensures consistent state management and reporting for all derived classes. It also provides utility methods for querying the node's name, the number of successful and failed checks, the number of test cases, and the overall result of the node.

All members and methods are defined within the micro_os_plus::micro_test_plus namespace, ensuring clear separation from user code and minimising the risk of naming conflicts.

Definition at line 145 of file test.h.

Public Constructors

test_node()

micro_os_plus::micro_test_plus::detail::test_node::test_node (const char * name)

Constructs a test node.

Parameters
[in] name

The test node name.

Stores the supplied name pointer, which is expected to point to a string with a lifetime exceeding that of this instance. If tracing is enabled, the name is output for diagnostic purposes.

Declaration at line 153 of file test.h, definition at line 84 of file test.cpp.

85 {
86#if defined(MICRO_OS_PLUS_TRACE) \
87 && defined(MICRO_OS_PLUS_TRACE_MICRO_TEST_PLUS_CONSTRUCTORS)
88#if defined(__GNUC__)
89#pragma GCC diagnostic push
90#if defined(__clang__)
91#pragma clang diagnostic ignored "-Wunsafe-buffer-usage-in-libc-call"
92#endif
93#endif
94 trace::printf ("%s '%s'\n", __PRETTY_FUNCTION__, name);
95#if defined(__GNUC__)
96#pragma GCC diagnostic pop
97#endif
98#endif // MICRO_OS_PLUS_TRACE_MICRO_TEST_PLUS_CONSTRUCTORS
99 }

References name and name_.

Referenced by micro_os_plus::micro_test_plus::detail::runnable_base::runnable_base, micro_os_plus::micro_test_plus::runner::runner, micro_os_plus::micro_test_plus::runner::runner, test_node, test_node, operator= and operator=.

test_node()

micro_os_plus::micro_test_plus::detail::test_node::test_node (const test_node &)
delete

Deleted copy constructor to prevent copying.

Definition at line 158 of file test.h.

Reference test_node.

test_node()

micro_os_plus::micro_test_plus::detail::test_node::test_node (test_node &&)
delete

Deleted move constructor to prevent moving.

Definition at line 163 of file test.h.

Reference test_node.

Public Destructor

~test_node()

micro_os_plus::micro_test_plus::detail::test_node::~test_node ()
virtual

Virtual destructor for the test_node class.

No resources are owned by test_node; the destructor performs no explicit clean-up. If tracing is enabled, the node name is output for diagnostic purposes.

Declaration at line 182 of file test.h, definition at line 107 of file test.cpp.

108 {
109#if defined(MICRO_OS_PLUS_TRACE) \
110 && defined(MICRO_OS_PLUS_TRACE_MICRO_TEST_PLUS_CONSTRUCTORS)
111#if defined(__GNUC__)
112#pragma GCC diagnostic push
113#if defined(__clang__)
114#pragma clang diagnostic ignored "-Wunsafe-buffer-usage-in-libc-call"
115#endif
116#endif
117 trace::printf ("%s '%s'\n", __PRETTY_FUNCTION__, name_);
118#if defined(__GNUC__)
119#pragma GCC diagnostic pop
120#endif
121#endif // MICRO_OS_PLUS_TRACE_MICRO_TEST_PLUS_CONSTRUCTORS
122 }

Reference name_.

Public Operators

operator=()

test_node & micro_os_plus::micro_test_plus::detail::test_node::operator= (const test_node &)
delete

Deleted copy assignment operator to prevent copying.

Definition at line 169 of file test.h.

Reference test_node.

operator=()

test_node & micro_os_plus::micro_test_plus::detail::test_node::operator= (test_node &&)
delete

Deleted move assignment operator to prevent moving.

Definition at line 176 of file test.h.

References test_node and totals.

Public Member Functions

name()

totals()

const runner_totals & micro_os_plus::micro_test_plus::detail::test_node::totals ()
inline nodiscard noexcept

Gets the totals for the test (const overload).

Parameters

None.

Returns

A const reference to the runner_totals instance.

Returns a const reference to the runner_totals member.

Declaration at line 215 of file test.h, definition at line 111 of file test-inlines.h.

111 test_node::totals () const noexcept
112 {
113 return totals_;
114 }

Reference totals_.

totals()

runner_totals & micro_os_plus::micro_test_plus::detail::test_node::totals ()
inline nodiscard noexcept

Protected Member Attributes

name_

const char* micro_os_plus::micro_test_plus::detail::test_node::name_
protected

The test node name.

info

Derived classes may access this member directly in addition to the public name() getter.

Definition at line 224 of file test.h.

224 const char* name_;

Referenced by test_node, micro_os_plus::micro_test_plus::detail::runnable< Self_T >::~runnable, micro_os_plus::micro_test_plus::detail::runnable_base::~runnable_base, ~test_node and name.

totals_

runner_totals micro_os_plus::micro_test_plus::detail::test_node::totals_
protected

The documentation for this class was generated from the following files:


Generated via doxygen2docusaurus 2.2.0 by Doxygen 1.17.0.