FUNCTION
The module contains functions to create and run testsuites. For an explanation of what a testsuite is see RBT_TestSuite. To test your application you create a number of testsuites and add testcases to these.
FUNCTION
This variable points to a linked list of testsuites. Instead of having the user keep track of the testsuites, this module keeps track of the testsuites. The only thing the user has to do is create them.
SEE ALSO
last_testsuite
SOURCE
RBT_TestSuite* first_testsuite = 0;
FUNCTION
Points to the last testsuite in a linked list of testsuites. Keeping track of this makes it easier to store the testsuites in the same order that they are added.
SOURCE
RBT_TestSuite* last_testsuite = 0;
FUNCTION
Create a new testsuite to which testcases can be added.
INPUTS
id -- a unique ID for this testsuite.
RETURN VALUE
A pointer to a newly created testsuite.
SOURCE
RBT_TestSuite* RBT_CreateSuite( char* id ) { RBT_TestSuite* new_testsuite = malloc( sizeof( RBT_TestSuite ) ); new_testsuite->id = strdup( id ); new_testsuite->first_testcase = 0; new_testsuite->last_testcase = 0; new_testsuite->next = 0; if( first_testsuite ) { last_testsuite->next = new_testsuite; last_testsuite = new_testsuite; } else { first_testsuite = new_testsuite; last_testsuite = new_testsuite; } return new_testsuite; }
FUNCTION
List the names of all the testsuites and all the testcases in these testsuites to stdout.
SOURCE
void RBT_ListCases( void ) { RBT_TestSuite* cur_suite = 0; for( cur_suite = RBT_GetFirstTestSuite(); cur_suite; cur_suite = RBT_GetNextTestSuite( cur_suite ) ) { RBT_TestCase* cur_case = 0; for ( cur_case = RBT_Get_FirstTestCase( cur_suite ); cur_case; cur_case = RBT_Get_NextTestCase( cur_case ) ) { printf("%s %s\n", cur_suite->id, cur_case->id ); } } }