diff -r 6068d965328b -r 3b552d7a9610 ucx/test.c --- a/ucx/test.c Fri Feb 08 11:25:04 2013 +0100 +++ b/ucx/test.c Fri Feb 08 17:09:12 2013 +0100 @@ -18,20 +18,45 @@ } void ucx_test_suite_free(UcxTestSuite* suite) { - ucx_list_free(suite->tests); + UcxTestList *l = suite->tests; + while (l != NULL) { + UcxTestList *e = l; + l = l->next; + free(e); + } free(suite); } -void ucx_test_register(UcxTestSuite* suite, UcxTest test) { - suite->tests = ucx_list_append(suite->tests, (void*) test); +int ucx_test_register(UcxTestSuite* suite, UcxTest test) { + if (suite->tests) { + UcxTestList *list = (UcxTestList*) malloc(sizeof(UcxTestList)); + if (list) { + list->test = test; + list->next = suite->tests; + suite->tests = list; + + return EXIT_SUCCESS; + } else { + return EXIT_FAILURE; + } + } else { + suite->tests = (UcxTestList*) malloc(sizeof(UcxTestList)); + if (suite->tests) { + suite->tests->test = test; + suite->tests->next = NULL; + + return EXIT_SUCCESS; + } else { + return EXIT_FAILURE; + } + } } void ucx_test_run(UcxTestSuite* suite, FILE* output) { suite->success = 0; suite->failure = 0; - UCX_FOREACH (UcxList*, suite->tests, e) { - UcxTest test = (UcxTest) (e->data); - test(suite, output); + UCX_FOREACH (UcxTestList*, suite->tests, e) { + e->test(suite, output); } fwrite("\nAll test completed.\n", 1, 21, output); fprintf(output, " Total: %d\n Success: %d\n Failure: %d\n",