|
micro-test-plus 6.0.0
µTest++ Testing Framework
|
Non-template base for all runnable objects (suites and test cases). More...
#include "micro-os-plus/micro-test-plus.h"
Public Member Functions | |
| runnable_base (const char *name, runner &test_runner, size_t own_index) | |
| Constructs a runnable_base with a name, runner, and index. | |
| runnable_base (const runnable_base &)=delete | |
| Deleted copy constructor to prevent copying. | |
| runnable_base (runnable_base &&)=delete | |
| Deleted move constructor to prevent moving. | |
| virtual | ~runnable_base () |
| Virtual destructor. | |
| const char * | name (void) const noexcept |
| Returns the node name. | |
| runnable_base & | operator= (const runnable_base &)=delete |
| Deleted copy assignment operator to prevent copying. | |
| runnable_base & | operator= (runnable_base &&)=delete |
| Deleted move assignment operator to prevent moving. | |
| const counters & | totals (void) const noexcept |
| Returns the totals of the node. | |
Deprecated Functions of runnable_base | |
| size_t | own_index (void) const noexcept |
| Deprecated positional index of this node within its parent. | |
| size_t | current_subtest_index (void) const noexcept |
| Deprecated number of the most recent child test point. | |
| size_t | children_subtests_count (void) const noexcept |
| Deprecated number of direct child test cases of this node. | |
Protected Member Functions | |
| bool | accepts_test_case (const suite &target, const located_name &name) |
| Checks whether a test case can be created on a suite. | |
| void | after_test_case_create (class test_case &test_case, suite &suite) |
| Counts a newly constructed child test case and executes it immediately. | |
| template<typename Callable_T, typename... Args_T> | |
| void | create_test_case (const located_name &name, suite &parent_suite, size_t nesting_depth, Callable_T &&callable, Args_T &&... arguments) |
| Creates a child test case, and runs it. | |
| suite * | exchange_running_suite (suite *running) noexcept |
| Replaces the suite whose body is running in the owning runner, and returns the previous one. | |
| bool | has_running_test_case_of (const suite &target) const noexcept |
| Checks whether the innermost running test case belongs to a suite. | |
| bool | is_aborted (void) const noexcept |
| Checks whether the test execution was aborted by the owning runner. | |
| bool | is_listing (void) const noexcept |
| Checks whether the owning runner lists the test cases instead of running them. | |
| size_t | next_test_point_number (void) noexcept |
| Advances to the next child test point, and returns its number. | |
| void | reject_body_exception (void) |
| Reports the exception that escaped the body of a suite while the test cases are listed, and records it. | |
| class test_case * | running_test_case (void) const noexcept |
| Returns the innermost test case being run by the owning runner, if any. | |
| class reporter & | test_reporter (void) const noexcept |
| Returns the test reporter associated with this test runnable. | |
| runner & | test_runner (void) const noexcept |
| Returns the test runner that owns this test runnable. | |
Protected Attributes | |
| size_t | child_test_cases_count_ = 0 |
| The number of direct child test cases. | |
| const char * | name_ |
| The node name. | |
| size_t | own_index_ |
| The test index, counting from 1. | |
| runner & | runner_ |
| Reference to the test runner that owns this object. | |
| size_t | test_point_number_ = 0 |
| The number of the most recent child test point. | |
| counters | totals_ |
| Totals for the node. | |
Private Member Functions | |
| void | abort (const reflection::source_location &sl=reflection::source_location::current()) const |
| Aborts test execution via the owning runner, for a failed requirement. | |
| virtual void | run (void)=0 |
| Runs the body of the test case or suite. | |
Friends | |
| class | check_result |
| The check result, which numbers and counts the checks. | |
| class | micro_test_plus::runner |
| The runner, which numbers and runs the suites. | |
| class | reporter_human |
| The human-readable reporter, which displays the nodes. | |
| class | reporter_tap |
| The TAP reporter, which displays the nodes. | |
runnable_base is the single base of the nodes of the test tree, and holds the state that is shared by every runnable object:
The concrete runnable classes (suite, test_case) derive from runnable_base; each refers to its body, which receives a reference to its own class, and implements run(), which invokes the body between the reporter notifications. A suite, which runs later, stores its body in a std::function; a test case, which runs immediately, refers to a body kept by its creator.
The user code can read only the name and the totals; the rest of the state, and the functions that run and abort the nodes, are the protocol between the nodes, the runner, the check result, and the reporters, which are friends. The runner numbers and runs the suites, the check result numbers and counts the checks, and the reporters read the indices and the test point numbers.
The class is non-copyable and non-movable to preserve unique ownership and consistent state throughout the test session.
| micro_os_plus::micro_test_plus::detail::runnable_base::runnable_base | ( | const char * | name, |
| runner & | test_runner, | ||
| size_t | own_index ) |
| name | The name used in reports. |
| test_runner | The test runner managing this object. |
| own_index | The positional index of this object within its parent. |
The constructor initialises a new instance of the runnable_base class with the specified name, runner reference, and own index; the name pointer is stored, and is expected to point to a string with a lifetime exceeding that of this instance. The totals, the child test point index, and the child test cases count start at zero. If tracing is enabled, the function signature is output for diagnostic purposes.
Definition at line 126 of file test.cpp.
References MICRO_OS_PLUS_MICRO_TEST_PLUS_PRI_SIZE, micro_test_plus::runner, name(), name_, own_index(), own_index_, runner_, and test_runner().
Referenced by runnable_base(), runnable_base(), micro_os_plus::micro_test_plus::suite::suite(), operator=(), and operator=().
|
delete |
A copy would duplicate the counters.
References runnable_base().
|
delete |
Nodes are referred to by address (e.g. by their children and by the runner), so they must not be relocated.
References runnable_base().
|
virtual |
Virtual, so that the derived nodes are destroyed correctly.
Nothing is owned; the child test cases were destroyed when the test() calls that created them returned. If tracing is enabled, the name is output for diagnostic purposes.
Definition at line 142 of file test.cpp.
References name_.
|
private |
Private, since it is used only by the check result, a friend, for a failed requirement without exceptions; the user code calls runner::abort().
| sl | The source location from which the abort is triggered. |
Delegates to the private runner::abort(), as caused by a failed requirement, passing the supplied source location, so that the report identifies it. The runner then calls the abort handler, if any, and terminates the process via ::abort().
Definition at line 306 of file test.cpp.
References micro_os_plus::micro_test_plus::runner::abort(), and runner_.
Referenced by micro_os_plus::micro_test_plus::detail::check_result::~check_result(), and run().
|
nodiscardprotected |
Protected, since it is used only by suite::test(). A test case can be created only on the suite whose body is running (the top suite, between runner::add_top_suite() and runner::run_suites(), or the suite being run). A call on any other suite, for example on the top suite from the body of another suite, on a static suite before the runner was initialised, or after runner::run_suites() returned, would run the test case where its results cannot be reported correctly. Such a call is rejected: the failure is reported as a failed check of the running test case, if one runs, otherwise in the running suite, or, when no suite runs, on stderr, and the rejection is remembered by the runner, which makes the exit code non-zero. When the session was declined (option errors, or --help), or aborted, the test cases are ignored silently, as after_test_case_create() ignores them.
| target | The suite on which the test case is created. |
| name | The name and the location of the test case, for the message. |
| true | The test case can be created. |
| false | The test case must not be created. |
The suite whose body runs accepts the test case. When the session was declined, or aborted, the test case is ignored, as after_test_case_create() ignores it.
Otherwise the call is rejected. If a test case runs (and the test cases are not only listed), the failure is reported as a check of that test case, so that it stays in its report. Otherwise, if a suite runs, the failure is reported as a check of that suite, with the same numbering and counting as the unexpected exceptions of the suite body. Otherwise (the runner was not initialised, has not started the suites, or has finished them, or the test cases are listed) the failure is given to runner::reject_call(), which writes the message on stderr and, where the reporter can still write it, as a comment line, for example in the list, and runner::mark_rejected() makes the exit code non-zero, as for the suites added too late.
Definition at line 239 of file test.cpp.
References micro_os_plus::micro_test_plus::runner::aborted_, micro_os_plus::micro_test_plus::detail::reporter::fail_suite(), micro_os_plus::micro_test_plus::runner::has_option_errors(), micro_os_plus::micro_test_plus::runner_options::help, micro_os_plus::micro_test_plus::counters::increment_failed_checks(), micro_os_plus::micro_test_plus::runner_options::list_tests, micro_os_plus::micro_test_plus::located_name::location(), name(), micro_os_plus::micro_test_plus::located_name::name(), next_test_point_number(), micro_os_plus::micro_test_plus::runner::options_, micro_os_plus::micro_test_plus::runner::reject_call(), micro_os_plus::micro_test_plus::test_case::report_rejected_test(), runner_, micro_os_plus::micro_test_plus::runner::running_suite_, micro_os_plus::micro_test_plus::runner::running_test_case_, test_reporter(), and totals_.
Referenced by run(), and micro_os_plus::micro_test_plus::suite::test().
|
protected |
The child test case is a local object of create_test_case(), and is destroyed when that function returns.
| test_case | The newly created test_case. |
| suite | The parent suite to which execution results are reported. |
Counts test_case, which is a local object of the calling create_test_case(), and immediately invokes test_case::run() on it. The test case is not kept; only child_test_cases_count_ is needed later, for the TAP plan.
If the filter patterns do not select the test case (its own name at its nesting level, or the name of suite at level 0, which matters only for the top suite, since the other suites run only when selected), its body is not called: the reporter is notified with skip_test_case() and the parent's skipped test cases counter is incremented. The test case keeps its index and its place among the children, so the TAP plan of the parent remains complete.
Otherwise, while the test case runs, the runner keeps it as its innermost running test case (see suite::test()). The parent's executed test cases counter is incremented after the run, and, if the child failed (a failed check, or a failed nested test case), its failed test cases counter too, so that the parent fails as well, as in node-tap. The child's check counters are intentionally not merged into the parent totals; each test case reports only its own counters. The child's totals are, however, accumulated into suite so that the suite summary reflects all checks performed by its test cases.
While the test cases are listed (see runner_options::list_tests), the selected test case is listed by the runner, and neither run nor counted, except in child_test_cases_count_.
After the test execution was aborted (possible only when the abort handler threw an exception, which the application caught), the report is complete, so the test case is neither run nor reported. The same applies when the runner refused to run the tests because of errors in the options, or because the output file could not be opened (see runner::has_option_errors()), or because the options requested the usage (--help).
Definition at line 350 of file test.cpp.
References micro_os_plus::micro_test_plus::runner::aborted_, child_test_cases_count_, micro_os_plus::micro_test_plus::runner::has_option_errors(), micro_os_plus::micro_test_plus::runner_options::help, micro_os_plus::micro_test_plus::counters::increment_executed_test_cases(), micro_os_plus::micro_test_plus::counters::increment_failed_test_cases(), micro_os_plus::micro_test_plus::counters::increment_skipped_test_cases(), micro_os_plus::micro_test_plus::runner::is_selected(), micro_os_plus::micro_test_plus::runner::list_test_case(), micro_os_plus::micro_test_plus::runner_options::list_tests, name(), micro_os_plus::micro_test_plus::test_case::nesting_depth(), micro_os_plus::micro_test_plus::runner::options_, micro_os_plus::micro_test_plus::counters::passed(), runner_, micro_os_plus::micro_test_plus::runner::running_test_case_, micro_os_plus::micro_test_plus::detail::reporter::skip_test_case(), test_reporter(), totals(), and totals_.
Referenced by create_test_case(), and run().
|
inlinenodiscardnoexcept |
Used only for the TAP plan, by the reporters, which access it directly. The test cases skipped by the filter are included.
Returns the number of direct child test cases, including those skipped by the filter.
Definition at line 241 of file test-inlines.h.
References child_test_cases_count_.
Referenced by operator=().
|
inlineprotected |
The common body of suite::test() and test_case::test(), which differ only in the parent suite and the nesting depth of the test cases they create.
Always inlined into them, even without optimisations, since each nested test case adds one call chain to the stack, and a separate frame for this function would make it longer.
The test case runs and ends within the call, so, without additional arguments, it refers to the callable of the caller, which is neither copied nor moved, and is called in place, so a callable that cannot be copied is accepted, and an lvalue callable keeps the changes of its state. With additional arguments, the callable and the arguments are bound into a body of copies, by bind_callable().
| Callable_T | The type of a callable object. |
| Args_T | The types of the callable arguments. |
| name | The test case name or description, used in reports, and the location of the call to test(). |
| parent_suite | The suite to which the test case belongs. |
| nesting_depth | The depth of nesting of the test case; 1 for the direct children of a suite. |
| callable | A generic callable object, usually a lambda, invoked to perform the test. |
| arguments | A possibly empty list of arguments to be passed to the callable. |
Without additional arguments, the child test_case is a local object that refers to the callable of the caller, which is neither copied nor moved, and is called in place (an lvalue callable keeps the changes of its state). A function is referred to through its pointer, and the callable and the additional arguments are bound into a local body, as copies, when there are arguments. The child is constructed with the next test point number of this node as its index, then passed to after_test_case_create(), which counts and runs it.
The child test case and its body, with the copies of the arguments, are destroyed when this function returns, so the memory used by a test session does not grow with the number of test cases; the stack holds one test case and one body for each level of nesting being run. Since the body is not stored in a std::function, it is never allocated, whatever the size of the lambda captures and of the arguments.
Definition at line 292 of file test-inlines.h.
References after_test_case_create(), micro_os_plus::micro_test_plus::detail::bind_callable(), name(), next_test_point_number(), own_index(), and runner_.
Referenced by run(), micro_os_plus::micro_test_plus::suite::test(), and micro_os_plus::micro_test_plus::test_case::test().
|
inlinenodiscardnoexcept |
Used only for the TAP output, by the reporters, which access it directly.
Returns the number of the most recent child test point.
Definition at line 229 of file test-inlines.h.
References test_point_number_.
Referenced by operator=().
|
protectednoexcept |
Protected, since it is used only by suite::run(), to mark the suite whose body is being called, and to restore the previous value when the body returns.
| running | The suite that starts to run, or the previous one, to restore it. |
Sets the pointer of the runner, a friend, and returns the previous value, so that the caller can restore it when the body returns.
Definition at line 212 of file test.cpp.
References runner_.
Referenced by run(), and micro_os_plus::micro_test_plus::suite::run().
|
nodiscardprotectednoexcept |
Protected, since it is used only by suite::test(), to forward a test case started on the suite to the running test case only when that is a test case of the same suite; the test cases started on another suite are rejected.
| target | The suite to check. |
| true | A test case is running, and its parent suite is target. |
| false | No test case is running, or it belongs to another suite. |
Reads the pointer of the runner, a friend, and the parent suite of the test case, which runnable_base may access.
Definition at line 199 of file test.cpp.
References micro_os_plus::micro_test_plus::test_case::parent_suite_, and runner_.
Referenced by run(), and micro_os_plus::micro_test_plus::suite::test().
|
nodiscardprotectednoexcept |
Protected, since it is used only by test_case::run() and suite::run(), to pass on an exception thrown by the abort handler, instead of reporting it as unexpected.
Returns the flag kept by the owning runner, set by runner::abort() and never cleared.
Definition at line 177 of file test.cpp.
References runner_.
Referenced by run(), micro_os_plus::micro_test_plus::suite::run(), and micro_os_plus::micro_test_plus::test_case::run().
|
nodiscardprotectednoexcept |
Protected, since it is used only by suite::run(), which then calls the suite body without reporting the suite, so that its test cases are created, and listed instead of run.
Returns runner_options::list_tests of the session options kept by the owning runner.
Definition at line 188 of file test.cpp.
References runner_.
Referenced by run(), and micro_os_plus::micro_test_plus::suite::run().
|
inlinenodiscardnoexcept |
Returns a pointer to the null-terminated name stored in name_.
Definition at line 195 of file test-inlines.h.
References name_.
Referenced by runnable_base(), micro_os_plus::micro_test_plus::runner::runner(), micro_os_plus::micro_test_plus::runner::runner(), micro_os_plus::micro_test_plus::static_suite::static_suite(), micro_os_plus::micro_test_plus::suite::suite(), micro_os_plus::micro_test_plus::test_case::test_case(), micro_os_plus::micro_test_plus::top_suite::top_suite(), accepts_test_case(), micro_os_plus::micro_test_plus::runner::add_top_suite(), after_test_case_create(), micro_os_plus::micro_test_plus::detail::reporter_human::begin_suite(), micro_os_plus::micro_test_plus::detail::reporter_tap::begin_suite(), micro_os_plus::micro_test_plus::detail::reporter_human::begin_test_case(), micro_os_plus::micro_test_plus::detail::reporter_tap::begin_test_case(), create_test_case(), micro_os_plus::micro_test_plus::test_case::detail::runnable_base, micro_os_plus::micro_test_plus::detail::reporter_human::display_open_heading(), micro_os_plus::micro_test_plus::detail::reporter_tap::display_open_heading(), micro_os_plus::micro_test_plus::detail::reporter_human::display_open_names(), micro_os_plus::micro_test_plus::detail::reporter_human::end_suite(), micro_os_plus::micro_test_plus::detail::reporter_tap::end_suite(), micro_os_plus::micro_test_plus::detail::reporter_human::end_test_case(), micro_os_plus::micro_test_plus::detail::reporter_tap::end_test_case(), micro_os_plus::micro_test_plus::detail::reporter_human::fail_suite(), micro_os_plus::micro_test_plus::detail::reporter_tap::fail_suite(), micro_os_plus::micro_test_plus::runner::list_test_case(), micro_os_plus::micro_test_plus::top_suite::micro_test_plus::runner, operator=(), micro_os_plus::micro_test_plus::suite::operator=(), micro_os_plus::micro_test_plus::test_case::operator=(), micro_os_plus::micro_test_plus::test_case::report_misdirected(), micro_os_plus::micro_test_plus::test_case::report_misdirected_test(), reporter_tap, run(), micro_os_plus::micro_test_plus::detail::reporter_human::skip_suite(), micro_os_plus::micro_test_plus::detail::reporter_tap::skip_suite(), micro_os_plus::micro_test_plus::detail::reporter_human::skip_test_case(), micro_os_plus::micro_test_plus::detail::reporter_tap::skip_test_case(), micro_os_plus::micro_test_plus::suite::static_suite, micro_os_plus::micro_test_plus::suite::test(), micro_os_plus::micro_test_plus::test_case::test(), micro_os_plus::micro_test_plus::suite::test_each(), micro_os_plus::micro_test_plus::suite::test_each(), micro_os_plus::micro_test_plus::test_case::test_each(), micro_os_plus::micro_test_plus::test_case::test_each(), and micro_os_plus::micro_test_plus::detail::reporter_tap::write_quiet_failures().
|
inlineprotectednoexcept |
Called for each check (by the check result, when the check is reported) and for each nested test case created.
Each call to test() invokes this member function before constructing the new test_case, and each check invokes it from the check result destructor, when the check is reported, so the numbers form a strictly increasing, one-based sequence of TAP test points, in output order.
Definition at line 255 of file test-inlines.h.
References test_point_number_.
Referenced by micro_os_plus::micro_test_plus::detail::check_result::~check_result(), accepts_test_case(), create_test_case(), micro_os_plus::micro_test_plus::suite::fail_unexpected_exception(), micro_os_plus::micro_test_plus::test_case::fail_unexpected_exception(), micro_os_plus::micro_test_plus::runner::reject_call(), and run().
|
delete |
A copy would duplicate the counters.
References runnable_base().
|
delete |
Nodes are referred to by address (e.g. by their children and by the runner), so they must not be relocated.
References runnable_base(), children_subtests_count(), current_subtest_index(), name(), own_index(), and totals().
|
inlinenodiscardnoexcept |
Used only for the TAP output, by the reporters, which access it directly. The setter of v5.0.1, and increment_subtest_index(), were removed, since they allowed the application code to corrupt the numbering of the reports.
Returns the one-based positional index of this node within its parent.
Definition at line 218 of file test-inlines.h.
References own_index_.
Referenced by runnable_base(), micro_os_plus::micro_test_plus::test_case::test_case(), create_test_case(), micro_os_plus::micro_test_plus::test_case::detail::runnable_base, operator=(), and reporter_tap.
|
protected |
Protected, since it is used only by suite::run(), when there is no test point to fail. It gives the message, which names the suite, to runner::reject_call(), which writes it on stderr and in the listing, and makes the exit code non-zero.
Builds the message here, and not in suite::run(), to keep the frame of that function, which is on the stack of every session, unchanged. Delegates to the private runner::reject_call(), which writes the message on stderr and in the listing, and marks the runner, so that the exit code of runner::run_suites() is not 0.
Definition at line 289 of file test.cpp.
References name_, micro_os_plus::micro_test_plus::runner::reject_call(), and runner_.
Referenced by run(), and micro_os_plus::micro_test_plus::suite::run().
|
privatepure virtual |
Implemented by test_case and suite, which invoke the stored callable surrounded by the reporter notifications.
Private, since the nodes are run only by the framework: the test cases by after_test_case_create(), when they are created, and the suites by the runner, which is a friend; a second run would report the node twice.
Implemented in micro_os_plus::micro_test_plus::suite, and micro_os_plus::micro_test_plus::test_case.
References abort(), accepts_test_case(), after_test_case_create(), create_test_case(), micro_os_plus::micro_test_plus::reflection::source_location::current(), exchange_running_suite(), has_running_test_case_of(), is_aborted(), is_listing(), micro_test_plus::runner, name(), next_test_point_number(), reject_body_exception(), running_test_case(), test_reporter(), and test_runner().
|
nodiscardprotectednoexcept |
Protected, since it is used only by suite::test(), to run a test case started on the suite from inside a running test case as a nested test case of it.
Returns the pointer kept by the owning runner, set by after_test_case_create() while a test case runs.
Definition at line 166 of file test.cpp.
References runner_.
Referenced by micro_os_plus::micro_test_plus::test_case::is_misdirected(), micro_os_plus::micro_test_plus::test_case::report_misdirected(), micro_os_plus::micro_test_plus::test_case::report_misdirected_test(), run(), and micro_os_plus::micro_test_plus::suite::test().
|
nodiscardprotectednoexcept |
Protected, since the reporter is internal to the framework; it is used by the suites and the test cases, which derive from this class, and by the check result, which is a friend.
Not named reporter(), which would hide the class detail::reporter in the derived classes.
Returns the reporter owned by the runner, through its reporter_ pointer, which is valid after runner::initialise().
Definition at line 155 of file test.cpp.
References runner_.
Referenced by micro_os_plus::micro_test_plus::detail::check_result::~check_result(), accepts_test_case(), after_test_case_create(), micro_os_plus::micro_test_plus::test_case::expect(), micro_os_plus::micro_test_plus::suite::fail_unexpected_exception(), micro_os_plus::micro_test_plus::test_case::fail_unexpected_exception(), micro_os_plus::micro_test_plus::test_case::report_misdirected(), micro_os_plus::micro_test_plus::test_case::report_rejected_test(), micro_os_plus::micro_test_plus::test_case::require(), run(), micro_os_plus::micro_test_plus::suite::run(), and micro_os_plus::micro_test_plus::test_case::run().
|
inlinenodiscardprotectednoexcept |
Protected, since the runner is internal to the framework; it is used by the suites and the test cases, which derive from this class and pass it to their nested test cases, and by the runner, which is a friend and selects the static suites it runs.
Not named runner(), which would hide the class runner in the derived classes.
Returns a reference to the owning test runner.
Definition at line 265 of file test-inlines.h.
References runner_.
Referenced by runnable_base(), micro_os_plus::micro_test_plus::static_suite::static_suite(), micro_os_plus::micro_test_plus::suite::suite(), micro_os_plus::micro_test_plus::test_case::test_case(), micro_os_plus::micro_test_plus::top_suite::top_suite(), micro_os_plus::micro_test_plus::test_case::detail::runnable_base, micro_os_plus::micro_test_plus::static_suite::link_or_reject(), micro_os_plus::micro_test_plus::top_suite::micro_test_plus::runner, reporter_tap, run(), and micro_os_plus::micro_test_plus::suite::static_suite.
|
inlinenodiscardnoexcept |
The reference is read-only, for the const and the non-const nodes alike, so that a test case or a suite cannot modify its own counters, which decide the exit code. The counters are updated only by the framework, which accesses the protected member directly.
Returns a const reference to the counters member.
Definition at line 205 of file test-inlines.h.
References totals_.
Referenced by after_test_case_create(), micro_os_plus::micro_test_plus::detail::reporter_human::end_suite(), micro_os_plus::micro_test_plus::detail::reporter_tap::end_suite(), micro_os_plus::micro_test_plus::detail::reporter_human::end_test_case(), micro_os_plus::micro_test_plus::detail::reporter_tap::end_test_case(), micro_os_plus::micro_test_plus::detail::reporter::format_suite_totals(), micro_os_plus::micro_test_plus::detail::reporter::format_test_case_totals(), operator=(), and micro_os_plus::micro_test_plus::runner::run_suites().
|
friend |
It advances the test point number, updates the totals, and reports the check through the reporter of the node.
Definition at line 366 of file test.h.
References check_result.
Referenced by check_result.
|
friend |
It sets the indices of the suites before running them, and selects the suites that refer to it.
Definition at line 357 of file test.h.
Referenced by runnable_base(), reporter_tap, and run().
|
friend |
It currently uses only the public members of the nodes; the declaration is kept for symmetry with the TAP reporter.
Definition at line 375 of file test.h.
References reporter_human.
Referenced by reporter_human.
|
friend |
It reads the indices and the test point numbers, for the TAP lines and plans, and, when tracing, the numbers of the child test cases.
Definition at line 385 of file test.h.
References micro_test_plus::runner, name(), own_index(), reporter_tap, and test_runner().
Referenced by reporter_tap.
|
protected |
Incremented for each call to test(), which creates a child test_case and runs it immediately. The child test cases are not kept after they run, so that the memory does not grow with the number of test cases; only their number is needed later, for the TAP plan.
Definition at line 883 of file test.h.
Referenced by after_test_case_create(), children_subtests_count(), micro_os_plus::micro_test_plus::detail::reporter_tap::end_suite(), and micro_os_plus::micro_test_plus::detail::reporter_tap::end_test_case().
|
protected |
Not owned; it points to a string whose lifetime exceeds that of the node. Derived classes may access this member directly, in addition to the public name() getter.
Definition at line 823 of file test.h.
Referenced by runnable_base(), micro_os_plus::micro_test_plus::suite::suite(), micro_os_plus::micro_test_plus::test_case::test_case(), ~runnable_base(), micro_os_plus::micro_test_plus::static_suite::~static_suite(), micro_os_plus::micro_test_plus::suite::~suite(), micro_os_plus::micro_test_plus::test_case::~test_case(), micro_os_plus::micro_test_plus::top_suite::~top_suite(), micro_os_plus::micro_test_plus::runner::add_top_suite(), micro_os_plus::micro_test_plus::suite::link(), name(), reject_body_exception(), micro_os_plus::micro_test_plus::suite::run(), and micro_os_plus::micro_test_plus::test_case::run().
|
protected |
The position of this object within its parent, displayed by the TAP reporter in the ok/not ok lines. Set directly by the runner, which numbers the suites when it runs them, and by the top suite, which, when added, is always the first one.
Definition at line 859 of file test.h.
Referenced by runnable_base(), micro_os_plus::micro_test_plus::suite::suite(), micro_os_plus::micro_test_plus::test_case::test_case(), micro_os_plus::micro_test_plus::top_suite::top_suite(), micro_os_plus::micro_test_plus::detail::reporter_tap::end_suite(), micro_os_plus::micro_test_plus::detail::reporter_tap::end_test_case(), own_index(), micro_os_plus::micro_test_plus::detail::reporter_tap::skip_suite(), and micro_os_plus::micro_test_plus::detail::reporter_tap::skip_test_case().
|
protected |
Provides access to the reporter, to the filter, and to the state of the session (the running test case, and the abort and listing flags), and is used when aborting.
Definition at line 848 of file test.h.
Referenced by runnable_base(), abort(), accepts_test_case(), after_test_case_create(), create_test_case(), exchange_running_suite(), has_running_test_case_of(), is_aborted(), is_listing(), reject_body_exception(), running_test_case(), test_reporter(), and test_runner().
|
protected |
Test points are numbered from 1; the value is 0 before the first one. This number counts the checks and the nested test cases of this object, in execution order, as required by the TAP ok/not ok lines. It is incremented for each check (by the check result) and for each nested test case created.
Definition at line 871 of file test.h.
Referenced by current_subtest_index(), micro_os_plus::micro_test_plus::detail::reporter_tap::end_suite(), micro_os_plus::micro_test_plus::detail::reporter_tap::fail_suite(), next_test_point_number(), micro_os_plus::micro_test_plus::detail::reporter_tap::output_fail_prefix(), micro_os_plus::micro_test_plus::detail::reporter_tap::output_pass_prefix(), and micro_os_plus::micro_test_plus::detail::reporter_tap::pass_without_text().
|
protected |
For the suites, the totals include the checks of all their test cases; for a test case, they include only its own checks, plus the counts of its direct nested test cases.
The check counters are updated by the check result, which is a friend; the test case counters by after_test_case_create(), when a nested test case ends. For a suite, the totals of each of its test cases are also added, by the same function.
Definition at line 838 of file test.h.
Referenced by micro_os_plus::micro_test_plus::detail::check_result::~check_result(), accepts_test_case(), after_test_case_create(), micro_os_plus::micro_test_plus::suite::fail_unexpected_exception(), micro_os_plus::micro_test_plus::test_case::fail_unexpected_exception(), micro_os_plus::micro_test_plus::runner::reject_call(), and totals().