5.1 C++ Suite Reference
- C++ Type: suite ¶
-
Main driver of the execution, C++ representation of the C type
micro_benchmark_suite
(see Suite Reference.)
- C++ Constructor: suite::suite (
char const*
name) ¶
-
- C++ Constructor: suite::suite (SL const& name) ¶
-
Preconditions:
- name points to a valid C string.
Effects:
- Creation of a new suite.
Postconditions:
- The created suite can be used.
- The name of the created suite is equivalent to name.
- C++ Method: char const* suite::name () const ¶
-
Preconditions:
-
*this
is a valid object.
Effects:
- None.
Postconditions:
- The created suite can be used.
- The name of the created suite is equivalent to name.
- C++ Type: <with-constraints> ¶
-
Internal type for the registration of a constraint function together
with the test. The provided value
micro_benchmark::with_constraints
has this type.
Note: The following interface is going to change, to allow
member function pointers and current register_class
functionality.
- C++ Method Template: test_case suite::register_test (char const* name, T&& test, SU&& set_up = <default_set_up>, TD&& tear_down = <default_tear_down>) ¶
-
- C++ Method Template: test_case suite::register_test (SL const& name, T&& test, SU&& set_up = <default_set_up>, TD&& tear_down = <default_tear_down>) ¶
-
Preconditions:
-
*this
is a valid object.
- T is a valid test type.
- SU is a valid set up type.
- TD is a valid tear down type.
- name points to a C string.
- test is a valid object or a pointer to a valid function.
- set_up is a valid object or a pointer to a valid function.
- tear_down is a valid object or a pointer to a valid function.
Effects:
- Register with name the test defined by test.
- Register set_up as its set up function if it is provided.
Otherwise use the default provided by the library is used.
- Register tear_down as its tear down function if it is provided.
Otherwise use the default provided by the library is used.
Postconditions:
- The returned value is a handle to the created test case.
- The returned value
test_case::name
is equivalent to name.
- The registered test will be executed by
suite::run
unless its
execution is disabled.
- C++ Method Template: test_case suite::register_test (<with-constraints>, C&& constraints, char const* name, T&& test, SU&& set_up = <default_set_up>, TD&& tear_down = <default_tear_down>) ¶
-
- C++ Method Template: test_case suite::register_test (<with-constraints>, C&& constraints, SL const& name, T&& test, SU&& set_up = <default_set_up>, TD&& tear_down = <default_tear_down>) ¶
-
Preconditions:
-
*this
is a valid object.
- C is a valid constraint type.
- T is a valid test type.
- SU is a valid set up type.
- TD is a valid tear down type.
- name points to a valid C string.
- constraints is a valid object.
- test is a valid object or a pointer to a valid function.
- set_up is a valid object or a pointer to a valid function.
- tear_down is a valid object or a pointer to a valid function.
Effects:
- Register with name the test defined by test.
- Register set_up as its set up function if it is provided.
Otherwise use the default provided by the library is used.
- Register tear_down as its tear down function if it is provided.
Otherwise use the default provided by the library is used.
- constraints is called with the defined test as its parameter.
Postconditions:
- The returned value is a handle to the created test case.
- The returned value
test_case::name
is equivalent to name.
- The registered test will be executed by
suite::run
unless its
execution is disabled by the constraints function or later
modifications of the test_case handle.
- C++ Method Template: test_case suite::register_class (char const* name, T&& test) ¶
-
- C++ Method Template: test_case suite::register_class (Sl const& name, T&& test) ¶
-
Preconditions:
-
*this
is a valid object.
- T defines an instance method
operator()
or
operator() const
with the right signature.
- name points to a valid C string.
Effects:
- The test defined by
test
in the suite with name.
- If
T
has a valid static member constraints
, it is
called with the defined test as its parameter.
Postconditions:
- The returned value is a handle to the created test case.
- The returned value
test_case::name
is equivalent to name.
- The registered test will be executed by
suite::run
unless its
execution is disabled by the constraints function or later
modifications of the test_case handle.
- If
T
has a valid instance member set_up
, it is
called before the test execution.
- If
T
has a valid instance member tear_down
, it is
called after the test execution.
- C++ Method: std::vector<test_case> suite::tests () const ¶
-
Preconditions:
-
*this
is a valid object.
Effects:
- None.
Postconditions:
- The returned value contains a handles of the registered tests up to
this.
- C++ Method: void suite::run () ¶
-
Preconditions:
-
*this
is a valid object.
-
this
->run
has not been called.
Effects:
- Run the registered and enabled tests.
Postconditions:
- The suite contains a report of the executions.
- C++ Method: report suite::stored_report () const ¶
-
Preconditions:
-
*this
is a valid object.
-
this
->run
has been called.
Effects:
- None.
Postconditions:
- The returned value contains a handles of the registered tests up to
this.