Next: , Previous: , Up: C++ API Reference   [Contents][Index]


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:

  1. None.

Effects:

  1. None.

Postconditions:

  1. 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:

  1. None.

Effects:

  1. *this is initialized with state of other.

Postconditions:

  1. The state of other is invalid.


C++ Assignment Operator: test_case& test_case::operator= (test_case&& other)

Preconditions:

  1. None.

Effects:

  1. The state of *this is the state of other.

Postconditions:

  1. 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:

  1. *this is in a valid state.
  2. values is a valid range.

Effects:

  1. A new dimension with values is added to the test constraints.

Postconditions:

  1. The number of dimensions in *this is increased by one.


C++ Method Template: void test_case::add_dimension (std::initializer_list<Tvalues)

Preconditions:

  1. *this is in a valid state.

Effects:

  1. A new dimension with values is added to the test constraints.

Postconditions:

  1. The number of dimensions in *this is increased by one.


C++ Method Template: void test_case::add_dimension (Iterator begin, Iterator end)

Preconditions:

  1. *this is in a valid state.
  2. begin is a valid iterator.
  3. end is a valid iterator.
  4. [beginend) is a valid range.

Effects:

  1. A new dimension with the values pointed by [beginend) is added to the test constraints.

Postconditions:

  1. 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:

  1. *this is in a valid state.
  2. values is in a valid state.

Effects:

  1. A new dimension with the values pointed by values is added to the test constraints.

Postconditions:

  1. The number of dimensions in *this is increased by one.


C++ Method: void test_case::number_of_dimensions () const

Preconditions:

  1. *this is in a valid state.

Effects:

  1. None.

Postconditions:

  1. 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:

  1. *this is in a valid state.
  2. number must be less than the number of dimensions stored on *this.

Effects:

  1. None.

Postconditions:

  1. 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:

  1. *this is in a valid state.

Effects:

  1. Any value provided to this function previously stop taking effect.
  2. The value it is stored for future usage.

Postconditions:

  1. 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:

  1. *this is in a valid state.

Effects:

  1. None.

Postconditions:

  1. 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:

  1. *this is in a valid state.
  2. Either:
    • The range [minmax] is valid.
    • max is zero.

Effects:

  1. Any value provided to this function previously stop taking effect.
  2. The provided values min and max are stored for future usage.

Postconditions:

  1. The test represented by *this will perform at least min iterations during the measurements.
  2. 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:

  1. *this is in a valid state.

Effects:

  1. None

Postconditions:

  1. 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:

  1. *this is in a valid state.

Effects:

  1. None

Postconditions:

  1. 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:

  1. *this is in a valid state.
  2. Either:
    • The range [minmax] is valid.
    • max is zero.

Effects:

  1. Any value provided to this function previously stop taking effect.
  2. The provided values min and max are stored for future usage.

Postconditions:

  1. The test represented by *this will perform at least min iterations each measurement sample.
  2. 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:

  1. *this is in a valid state.

Effects:

  1. None

Postconditions:

  1. 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:

  1. *this is in a valid state.

Effects:

  1. None

Postconditions:

  1. 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:

  1. *this is in a valid state.

Effects:

  1. Any value provided to this function previously stop taking effect.
  2. The provided value will be used as time limit for the test

Postconditions:

  1. 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:

  1. *this is in a valid state.
  2. ns is less than 1 second.

Effects:

  1. Any value provided to this function previously stop taking effect.
  2. The provided value will be used as time limit for the test

Postconditions:

  1. 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:

  1. *this is in a valid state.

Effects:

  1. None

Postconditions:

  1. The returned value represents the time limit stored on *this.



Next: C++ State Reference, Previous: C++ Suite Reference, Up: C++ API Reference   [Contents][Index]