5.2 C++ Test Reference
- C++ Type: test_case ¶
-
Test case handle.
The objects returned by suite::register_test
,
suite::register_class
are in a valid state, as well as
the objects provided by the library to a constraint function through
its parameter.
- C++ Constructor: test_case::test_case () ¶
-
Preconditions:
- None.
Effects:
- None.
Postconditions:
- The created object state is not valid. The only defined operations
defined on the created object are the assignment from another object
and the destruction.
- C++ Constructor: test_case::test_case (test_case&& other) ¶
-
Preconditions:
- None.
Effects:
-
*this
is initialized with state of other.
Postconditions:
- The state of other is invalid.
- C++ Assignment Operator: test_case& test_case::operator= (test_case&& other) ¶
-
Preconditions:
- None.
Effects:
- The state of
*this
is the state of other.
Postconditions:
- The state of other is invalid.
The following methods modify the constraints applied to the test
execution.
- C++ Method Template: void test_case::add_dimension (Range values) ¶
-
Preconditions:
-
*this
is in a valid state.
- values is a valid range.
Effects:
- A new dimension with values is added to the test constraints.
Postconditions:
- The number of dimensions in
*this
is increased by one.
- C++ Method Template: void test_case::add_dimension (std::initializer_list<T> values) ¶
-
Preconditions:
-
*this
is in a valid state.
Effects:
- A new dimension with values is added to the test constraints.
Postconditions:
- The number of dimensions in
*this
is increased by one.
- C++ Method Template: void test_case::add_dimension (Iterator begin, Iterator end) ¶
-
Preconditions:
-
*this
is in a valid state.
- begin is a valid iterator.
- end is a valid iterator.
- [begin, end) is a valid range.
Effects:
- A new dimension with the values pointed by
[begin, end) is added to the test constraints.
Postconditions:
- The number of dimensions in
*this
is increased by one.
- C++ Method: void test_case::add_dimension (std::vector<std::size_t> const& values) ¶
-
Preconditions:
-
*this
is in a valid state.
- values is in a valid state.
Effects:
- A new dimension with the values pointed by values is added to
the test constraints.
Postconditions:
- The number of dimensions in
*this
is increased by one.
- C++ Method: void test_case::number_of_dimensions () const ¶
-
Preconditions:
-
*this
is in a valid state.
Effects:
- None.
Postconditions:
- The returned value is number of dimensions stored in the test pointed
by
this
.
- C++ Method: void test_case::get_dimension (std::size_t number) const ¶
-
Preconditions:
-
*this
is in a valid state.
- number must be less than the number of dimensions stored on
*this
.
Effects:
- None.
Postconditions:
- The returned value is values of the dimension number stored in
the test pointed by
this
.
- C++ Method: void test_case::skip_iterations (std::size_t it) ¶
-
Preconditions:
-
*this
is in a valid state.
Effects:
- Any value provided to this function previously stop taking effect.
- The value it is stored for future usage.
Postconditions:
- The test represented by
*this
will perform it iterations
before start taking measurements.
- C++ Method: std::size_t test_case::iterations_to_skip () const ¶
-
Preconditions:
-
*this
is in a valid state.
Effects:
- None.
Postconditions:
- The returned value represents the iterations that
*this
will
perform before start taking measurements.
Iteration Limits
The following function control the number of iterations performed by
the code under test.
- C++ Method: std::size_t test_case::limit_iterations (std::size_t min, std::size_t max) ¶
-
Preconditions:
-
*this
is in a valid state.
- Either:
- The range [min, max] is valid.
- max is zero.
Effects:
- Any value provided to this function previously stop taking effect.
- The provided values min and max are stored for future
usage.
Postconditions:
- The test represented by
*this
will perform at least min
iterations during the measurements.
- The test represented by
*this
will perform at most max
iterations during the measurements.
- C++ Method: std::size_t test_case::min_iterations () const ¶
-
Preconditions:
-
*this
is in a valid state.
Effects:
- None
Postconditions:
- The returned value represents ne minimum number of iterations that the
test represented by
*this
will perform while taking
measurements.
- C++ Method: std::size_t test_case::max_iterations () const ¶
-
Preconditions:
-
*this
is in a valid state.
Effects:
- None
Postconditions:
- The returned value represents ne maximum number of iterations that the
test represented by
*this
will perform while taking
measurements.
The following function control the iterations performed on each
measurement sample taken.
- C++ Method: void test_case::limit_samples (std::size_t min, std::size_t max) ¶
-
Preconditions:
-
*this
is in a valid state.
- Either:
- The range [min, max] is valid.
- max is zero.
Effects:
- Any value provided to this function previously stop taking effect.
- The provided values min and max are stored for future
usage.
Postconditions:
- The test represented by
*this
will perform at least min
iterations each measurement sample.
- The test represented by
*this
will perform at most max
iterations each measurement sample.
- C++ Method: std::size_t test_case::min_sample_iterations () const ¶
-
Preconditions:
-
*this
is in a valid state.
Effects:
- None
Postconditions:
- The returned value represents the minimum number of iterations
performed on each measurement sample taken during the execution of the
test represented by
*this
.
- C++ Method: std::size_t test_case::max_sample_iterations () const ¶
-
Preconditions:
-
*this
is in a valid state.
Effects:
- None
Postconditions:
- The returned value represents the maximum number of iterations
performed on each measurement sample taken during the execution of the
test represented by
*this
.
The following functions limit the test time:
- C++ Method: void test_case::max_time (std::chrono::seconds s) ¶
-
- C++ Method: void test_case::max_time (std::chrono::nanoseconds ns) ¶
-
Preconditions:
-
*this
is in a valid state.
Effects:
- Any value provided to this function previously stop taking effect.
- The provided value will be used as time limit for the test
Postconditions:
- The test represented by
*this
will have the provided time as
its time limit.
- C++ Method: void test_case::max_time (std::chrono::seconds s, std::chrono::nanoseconds ns) ¶
-
Preconditions:
-
*this
is in a valid state.
- ns is less than 1 second.
Effects:
- Any value provided to this function previously stop taking effect.
- The provided value will be used as time limit for the test
Postconditions:
- The test represented by
*this
will have the provided time as
its time limit.
- C++ Method: std::pair<std::chrono::seconds, std::chrono::nanoseconds> test_case::max_time () const ¶
-
Preconditions:
-
*this
is in a valid state.
Effects:
- None
Postconditions:
- The returned value represents the time limit stored on
*this
.