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


4.2.1 Test Definition Reference

C Function Type: micro_benchmark_set_up_fun

Its prototype is void *(*) (micro_benchmark_test_state).


C Function Type: micro_benchmark_tear_down_fun

Its prototype is void (*) (micro_benchmark_test_state, void *).


C Function Type: micro_benchmark_auto_test_fun

Its prototype is void (*) (void *).


C Function Type: micro_benchmark_test_fun

Its prototype is void (*) (micro_benchmark_test_state).


C Data Type: micro_benchmark_test_definition { bool is_auto, micro_benchmark_set_up_fun set_up, micro_benchmark_tear_down_fun tear_down, micro_benchmark_auto_test_fun auto_test, micro_benchmark_test_fun test }

Definition of a test case.


C Data Type: micro_benchmark_test_case_definition

Opaque type of a registered test case.


C Test Function: const char * micro_benchmark_test_case_get_name (micro_benchmark_test_case test)

Preconditions

  1. Either:
    • test has been obtained through micro_benchmark_suite_register_test.
    • test has been obtained through micro_benchmark_suite_get_test.
    • test has been received as a parameter on a constraint definition and the scope of that function call is still active.
  2. The suite associated to test is still valid.

Effects:

  1. None.

Postconditions:

  1. The returned value is not NULL.
  2. The returned value is the name used to register the test case.


C Test Function: micro_benchmark_test micro_benchmark_test_case_get_definition (micro_benchmark_test_case test)

Preconditions:

  1. Either:
    • test has been obtained through micro_benchmark_suite_register_test.
    • test has been obtained through micro_benchmark_suite_get_test.
    • test has been received as a parameter on a constraint definition and the scope of that function call is still active.
  2. The suite associated to test is still valid.

Effects:

  1. None.

Postconditions:

  1. The returned value is not NULL.
  2. The micro_benchmark_test_definition pointed by the returned value contains the same values as the one the provided to micro_benchmark_suite_register_test or MICRO_BENCHMARK_REGISTER_ macro family.


C Test Function: void micro_benchmark_test_case_set_enabled (micro_benchmark_test_case test, bool enabled)

Preconditions:

  1. Either:
    • test has been obtained through micro_benchmark_suite_register_test.
    • test has been obtained through micro_benchmark_suite_get_test.
    • test has been received as a parameter on a constraint definition and the scope of that function call is still active.
  2. The suite associated to test is still valid.

Effects:

  1. Any previous value provided to this function stops taking effect.
  2. Activate the execution of test if enabled is true.
  3. Deactivate the execution of test otherwise.

Postconditions:

  1. The test will run if enabled is true.


C Test Function: void micro_benchmark_test_case_is_enabled (micro_benchmark_test_case test)

Preconditions:

  1. Either:
    • test has been obtained through micro_benchmark_suite_register_test.
    • test has been obtained through micro_benchmark_suite_get_test.
    • test has been received as a parameter on a constraint definition and the scope of that function call is still active.
  2. The suite associated to test is still valid.

Effects:

  1. Check the status of the test.

Postconditions:

  1. If micro_benchmark_test_case_set_enabled was called with test as its parameter, the returned value is the value provided as its parameter.


C Test Function: void micro_benchmark_test_case_set_data (micro_benchmark_test_case test, void *data, void (*cleanup) (void *))

Preconditions:

  1. Either:
    • test has been obtained through micro_benchmark_suite_register_test.
    • test has been obtained through micro_benchmark_suite_get_test.
    • test has been received as a parameter on a constraint definition and the scope of that function call is still active.
  2. The suite associated to test is still valid.
  3. cleanup points to a valid function for this signature.

Effects:

  1. data is stored on the test case.
  2. cleanup is stored on the test case.

Postconditions:

  1. cleanup will be called with data as its parameter at the end of test lifetime.


C Test Function: void * micro_benchmark_test_case_get_data (micro_benchmark_test_case test)

Preconditions:

  1. Either:
    • test has been obtained through micro_benchmark_suite_register_test.
    • test has been obtained through micro_benchmark_suite_get_test.
    • test has been received as a parameter on a constraint definition and the scope of that function call is still active.
  2. The suite associated to test is still valid.
  3. cleanup points to a valid function for this signature.

Effects:

  1. None.

Postconditions:

  1. The returned value is the object pointer provided to micro_benchmark_test_case_set_data or NULL if micro_benchmark_test_case_set_data has not been called.



Next: Test Constraints Reference, Up: Test Reference   [Contents][Index]