FUNCTION
This module contains functions to create and run testcases. A testcase usually tests one or two functions of your application. Testcases are stored in RBT_TestCase structures.
FUNCTION
Run a particular testcase. This call the setup function if present, the test function, and the teardown function if present.
INPUTS
o testcase -- the testcase to run.
SOURCE
void RBT_Run( RBT_TestCase* testcase ) { if ( testcase->setup_function ) { (testcase->setup_function)(); } (testcase->test_function)(); if ( testcase->teardown_function ) { (testcase->teardown_function)(); } printf("COMPLETE:\n"); }
FUNCTION
Create a new testcase.
INPUTS
o id -- a unique ID for this testcase o setup_function -- a setup function or NULL o test_function -- the testfunction o teardown_function -- a teardown function or NULL
SOURCE
RBT_TestCase* RBT_CreateTestCase( char* id, SetupFunction setup_function, TestFunction test_function, TestFunction teardown_function ) { RBT_TestCase* new_testcase = malloc( sizeof( RBT_TestCase ) ); new_testcase->id = strdup( id ); new_testcase->setup_function = setup_function; new_testcase->test_function = test_function; new_testcase->teardown_function = teardown_function; new_testcase->next = 0; return new_testcase; }