--- a/test/main.c Mon Feb 25 16:26:50 2013 +0100 +++ b/test/main.c Wed Feb 27 09:41:17 2013 +0100 @@ -65,15 +65,23 @@ UCX_TEST_END } -UCX_TEST_SUBROUTINE(testTestSuiteRoutineSuccess,field) { - int* i = (int*) field; +UCX_TEST_SUBROUTINE(testTestSuiteRoutineRoutine, float f) { + UCX_TEST_ASSERT(f == 3.14f, "calling routine in a routine fails"); +} + +UCX_TEST_SUBROUTINE(testTestSuiteRoutine2Param, int i, float f) { + UCX_TEST_ASSERT(i == 42, "two parameter routine fails"); + UCX_TEST_CALL_SUBROUTINE(testTestSuiteRoutineRoutine, f); +} + +UCX_TEST_SUBROUTINE(testTestSuiteRoutineSuccess, int* i) { *i += 2; UCX_TEST_ASSERT(*i==4, "the test framework fails"); } -UCX_TEST_SUBROUTINE(testTestSuiteRoutineFailure,field) { - int* i = (int*) field; +UCX_TEST_SUBROUTINE(testTestSuiteRoutineFailure, int* i) { *i += 2; + // Next test shall fail! UCX_TEST_ASSERT(*i==4, "the test framework works"); } @@ -93,6 +101,12 @@ UCX_TEST_END } +UCX_TEST_IMPLEMENT(testTestSuiteRoutineMultiparam) { + UCX_TEST_BEGIN + UCX_TEST_CALL_SUBROUTINE(testTestSuiteRoutine2Param, 42, 3.14f); + UCX_TEST_END +} + int main(int argc, char **argv) { printf("UCX Tests\n---------\n"); @@ -102,8 +116,9 @@ ucx_test_register(suite, testTestSuiteNegative); ucx_test_register(suite, testTestSuiteRoutinePositive); ucx_test_register(suite, testTestSuiteRoutineNegative); + ucx_test_register(suite, testTestSuiteRoutineMultiparam); ucx_test_run(suite, stdout); - if (suite->failure == 2 && suite->success == 2) { + if (suite->failure == 2 && suite->success == 3) { ucx_test_suite_free(suite); printf("\nLibrary function tests\n");