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


4.1 Suite Reference

The suite is represented by the following type:

C Data Type: micro_benchmark_suite

Opaque pointer type. This object controls the lifetime of their derived objects, so all references obtained using an object of this type are bound to the lifetime of that object.


C Suite Function: micro_benchmark_suite micro_benchmark_suite_create (const char *name)

Preconditions:

  1. name must point to a valid, zero-ended array of characters.

Effects:

  1. Creation of a new suite with name as its name.

Postconditions:

  1. The returned value is not NULL.


C Suite Function: void micro_benchmark_suite_release (micro_benchmark_suite suite)

Preconditions

  1. suite has been obtained through micro_benchmark_suite_create.

Effects:

  1. The resources associated to suite are released.

Postconditions:

  1. Any object pointer obtained through suite, including suite, is invalidated.


C Suite Function: const char * micro_benchmark_suite_get_name (micro_benchmark_suite suite)

Preconditions:

  1. suite has been obtained through micro_benchmark_suite_create.

Effects:

  1. None.

Postconditions:

  1. The returned value is equivalent to the one provided  to the call of micro_benchmark_suite_create that originated this suite.


C Suite Function: micro_benchmark_test_case micro_benchmark_suite_register_test (micro_benchmark_suite suite, const char *name, micro_benchmark_test test)

Preconditions:

  1. suite has been obtained through micro_benchmark_suite_create.
  2. name must point to a valid, zero-ended array of characters.
  3. test must point to a valid object.

Effects:

  1. test is added as name to the test set that suite will run.

Postconditions:

  1. The returned value is not NULL.
  2. The returned value points to the registered test is enabled.
  3. The registered test is enabled.
  4. The registered test contains a disjoint copy of test.


C Suite Function: size_t micro_benchmark_suite_get_number_of_tests (micro_benchmark_suite suite)

Preconditions:

  1. suite has been obtained through micro_benchmark_suite_create.

Effects:

  1. The number of tests registered on suite, including the internal test used to calculate the overhead of the framework.

Postconditions:

  1. The suite is not modified.


Note that no interface to retrieve tests by name is provided, as several tests might be registered under the same name.

C Suite Function: micro_benchmark_test_case micro_benchmark_suite_get_test (micro_benchmark_suite suite, size_t pos)

Preconditions:

  1. suite has been obtained through micro_benchmark_suite_create.
  2. pos is less than the value returned by micro_benchmark_suite_get_number_of_tests.

Effects:

  1. None.

Postconditions:

  1. The suite is not modified.
  2. The return value is a reference to the test case at pos from suite.


C Suite Function: void micro_benchmark_suite_run (micro_benchmark_suite suite)

Preconditions:

  1. suite has been obtained through micro_benchmark_suite_create.
  2. micro_benchmark_suite_run (suite) has not been called.

Effects:

  1. The tests registered on suite whose status is enabled are run.
  2. The tests registered on suite whose status is not enabled are not run.

Postconditions:

  1. A report is available through micro_benchmark_suite_get_report.


C Suite Function: micro_benchmark_report micro_benchmark_suite_get_report (micro_benchmark_suite suite)

Preconditions:

  1. suite has been obtained through micro_benchmark_suite_create.
  2. micro_benchmark_suite_run (suite) has been called.

Effects:

  1. None.

Postconditions:

  1. The returned value is not NULL.
  2. The returned value is eport stored on suite.



Next: Test Reference, Up: C API Reference   [Contents][Index]