1.1 --- a/test/main.c Wed Oct 18 14:23:57 2017 +0200 1.2 +++ b/test/main.c Wed Oct 18 19:10:29 2017 +0200 1.3 @@ -45,61 +45,65 @@ 1.4 #include "utils_tests.h" 1.5 #include "avl_tests.h" 1.6 1.7 +#ifdef __cplusplus 1.8 extern "C" { 1.9 - UCX_TEST(testTestSuitePositive) { 1.10 - UCX_TEST_BEGIN 1.11 - UCX_TEST_ASSERT(2*2 == 4, "the test framework fails"); 1.12 - UCX_TEST_END 1.13 - } 1.14 +#endif 1.15 +UCX_TEST(testTestSuitePositive) { 1.16 + UCX_TEST_BEGIN 1.17 + UCX_TEST_ASSERT(2*2 == 4, "the test framework fails"); 1.18 + UCX_TEST_END 1.19 +} 1.20 1.21 - UCX_TEST(testTestSuiteNegative) { 1.22 - UCX_TEST_BEGIN 1.23 - UCX_TEST_ASSERT(2*(-2) == 4, "the test framework works"); 1.24 - UCX_TEST_END 1.25 - } 1.26 +UCX_TEST(testTestSuiteNegative) { 1.27 + UCX_TEST_BEGIN 1.28 + UCX_TEST_ASSERT(2*(-2) == 4, "the test framework works"); 1.29 + UCX_TEST_END 1.30 +} 1.31 1.32 - UCX_TEST_SUBROUTINE(testTestSuiteRoutineRoutine, float f) { 1.33 - UCX_TEST_ASSERT(f == 3.14f, "calling routine in a routine fails"); 1.34 - } 1.35 +UCX_TEST_SUBROUTINE(testTestSuiteRoutineRoutine, float f) { 1.36 + UCX_TEST_ASSERT(f == 3.14f, "calling routine in a routine fails"); 1.37 +} 1.38 1.39 - UCX_TEST_SUBROUTINE(testTestSuiteRoutine2Param, int i, float f) { 1.40 - UCX_TEST_ASSERT(i == 42, "two parameter routine fails"); 1.41 - UCX_TEST_CALL_SUBROUTINE(testTestSuiteRoutineRoutine, f); 1.42 - } 1.43 +UCX_TEST_SUBROUTINE(testTestSuiteRoutine2Param, int i, float f) { 1.44 + UCX_TEST_ASSERT(i == 42, "two parameter routine fails"); 1.45 + UCX_TEST_CALL_SUBROUTINE(testTestSuiteRoutineRoutine, f); 1.46 +} 1.47 1.48 - UCX_TEST_SUBROUTINE(testTestSuiteRoutineSuccess, int* i) { 1.49 - *i += 2; 1.50 - UCX_TEST_ASSERT(*i==4, "the test framework fails"); 1.51 - } 1.52 +UCX_TEST_SUBROUTINE(testTestSuiteRoutineSuccess, int* i) { 1.53 + *i += 2; 1.54 + UCX_TEST_ASSERT(*i==4, "the test framework fails"); 1.55 +} 1.56 1.57 - UCX_TEST_SUBROUTINE(testTestSuiteRoutineFailure, int* i) { 1.58 - *i += 2; 1.59 - // Next test shall fail! 1.60 - UCX_TEST_ASSERT(*i==4, "the test framework works"); 1.61 - } 1.62 +UCX_TEST_SUBROUTINE(testTestSuiteRoutineFailure, int* i) { 1.63 + *i += 2; 1.64 + // Next test shall fail! 1.65 + UCX_TEST_ASSERT(*i==4, "the test framework works"); 1.66 +} 1.67 1.68 - UCX_TEST(testTestSuiteRoutinePositive) { 1.69 - int i = 2; 1.70 - UCX_TEST_BEGIN 1.71 - UCX_TEST_CALL_SUBROUTINE(testTestSuiteRoutineSuccess, &i); 1.72 - UCX_TEST_ASSERT(i==4, "the test framework fails"); 1.73 - UCX_TEST_END 1.74 - } 1.75 +UCX_TEST(testTestSuiteRoutinePositive) { 1.76 + int i = 2; 1.77 + UCX_TEST_BEGIN 1.78 + UCX_TEST_CALL_SUBROUTINE(testTestSuiteRoutineSuccess, &i); 1.79 + UCX_TEST_ASSERT(i==4, "the test framework fails"); 1.80 + UCX_TEST_END 1.81 +} 1.82 1.83 - UCX_TEST(testTestSuiteRoutineNegative) { 1.84 - int i = 0; 1.85 - UCX_TEST_BEGIN 1.86 - UCX_TEST_CALL_SUBROUTINE(testTestSuiteRoutineFailure, &i); 1.87 - UCX_TEST_ASSERT(1, "the test framework fails"); 1.88 - UCX_TEST_END 1.89 - } 1.90 +UCX_TEST(testTestSuiteRoutineNegative) { 1.91 + int i = 0; 1.92 + UCX_TEST_BEGIN 1.93 + UCX_TEST_CALL_SUBROUTINE(testTestSuiteRoutineFailure, &i); 1.94 + UCX_TEST_ASSERT(1, "the test framework fails"); 1.95 + UCX_TEST_END 1.96 +} 1.97 1.98 - UCX_TEST(testTestSuiteRoutineMultiparam) { 1.99 - UCX_TEST_BEGIN 1.100 - UCX_TEST_CALL_SUBROUTINE(testTestSuiteRoutine2Param, 42, 3.14f); 1.101 - UCX_TEST_END 1.102 - } 1.103 +UCX_TEST(testTestSuiteRoutineMultiparam) { 1.104 + UCX_TEST_BEGIN 1.105 + UCX_TEST_CALL_SUBROUTINE(testTestSuiteRoutine2Param, 42, 3.14f); 1.106 + UCX_TEST_END 1.107 } 1.108 +#ifdef __cplusplus 1.109 +} 1.110 +#endif 1.111 1.112 int main(int argc, char **argv) { 1.113 printf("UCX Tests\n---------\n");