Next: , Previous: , Up: Top   [Contents][Index]


5 Test functions

Test functions are where the meat of the tests is placed. We can define a test function as:

void
test_1_1 (cce_destination_t L)
{
  ...
}
Preprocessor Macro: void cctests_run (cctests_fun_t * fun)

Run the test function fun in the context of the currently active test group. Print reports on log stream. The string name of fun is used as follows:

Function Typedef: void cctests_fun_t (cce_destination_t L)

Prototype of test functions run by cctests_run(). When the test completes successfully:

If an error occurs: the test function must raise an exception of type cctests_condition_failure_t by performing a non–local exit to L.

If the test function raises an exceptional condition of a type different from cctests_condition_success_t and cctests_condition_failure_t: the function is considered failed with a hard error.

Function: bool cctests_latest_func_completed_successfully (void)

Return true if the latest test function has completed successfully; otherwise return false.

Function: void cctests_skip (void)

Raise an exception of type cctests_condition_skipped_t to signal that this test function skips its test. This is useful, for example, if a test function is written for a testee function that may not exist on the underlying platform; so we can write a test like this:

void
test_1_1 (cce_destination_t upper_L)
{
#ifdef HAVE_TESTEE_FUNCTION
  ...
#else
  cctests_skip();
#endif
}

Next: , Previous: , Up: Top   [Contents][Index]

This document describes version 0.4.1-devel.1 of CCTests.