test/main.c

changeset 254
c45c385ac578
parent 253
e19825a1430a
child 259
2f5dea574a75
--- a/test/main.c	Wed Oct 18 14:23:57 2017 +0200
+++ b/test/main.c	Wed Oct 18 19:10:29 2017 +0200
@@ -45,61 +45,65 @@
 #include "utils_tests.h"
 #include "avl_tests.h"
 
+#ifdef __cplusplus
 extern "C" {
-    UCX_TEST(testTestSuitePositive) {
-        UCX_TEST_BEGIN
-        UCX_TEST_ASSERT(2*2 == 4, "the test framework fails");
-        UCX_TEST_END
-    }
-
-    UCX_TEST(testTestSuiteNegative) {
-        UCX_TEST_BEGIN
-        UCX_TEST_ASSERT(2*(-2) == 4, "the test framework works");
-        UCX_TEST_END
-    }
+#endif
+UCX_TEST(testTestSuitePositive) {
+    UCX_TEST_BEGIN
+    UCX_TEST_ASSERT(2*2 == 4, "the test framework fails");
+    UCX_TEST_END
+}
 
-    UCX_TEST_SUBROUTINE(testTestSuiteRoutineRoutine, float f) {
-        UCX_TEST_ASSERT(f == 3.14f, "calling routine in a routine fails");
-    }
+UCX_TEST(testTestSuiteNegative) {
+    UCX_TEST_BEGIN
+    UCX_TEST_ASSERT(2*(-2) == 4, "the test framework works");
+    UCX_TEST_END
+}
+
+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(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(testTestSuiteRoutineSuccess, int* i) {
+    *i += 2;
+    UCX_TEST_ASSERT(*i==4, "the test framework fails");
+}
 
-    UCX_TEST_SUBROUTINE(testTestSuiteRoutineFailure, int* i) {
-        *i += 2;
-        // Next test shall fail!
-        UCX_TEST_ASSERT(*i==4, "the test framework works");
-    }
+UCX_TEST_SUBROUTINE(testTestSuiteRoutineFailure, int* i) {
+    *i += 2;
+    // Next test shall fail!
+    UCX_TEST_ASSERT(*i==4, "the test framework works");
+}
 
-    UCX_TEST(testTestSuiteRoutinePositive) {
-        int i = 2;
-        UCX_TEST_BEGIN
-        UCX_TEST_CALL_SUBROUTINE(testTestSuiteRoutineSuccess, &i);
-        UCX_TEST_ASSERT(i==4, "the test framework fails");
-        UCX_TEST_END
-    }
+UCX_TEST(testTestSuiteRoutinePositive) {
+    int i = 2;
+    UCX_TEST_BEGIN
+    UCX_TEST_CALL_SUBROUTINE(testTestSuiteRoutineSuccess, &i);
+    UCX_TEST_ASSERT(i==4, "the test framework fails");
+    UCX_TEST_END
+}
 
-    UCX_TEST(testTestSuiteRoutineNegative) {
-        int i = 0;
-        UCX_TEST_BEGIN
-        UCX_TEST_CALL_SUBROUTINE(testTestSuiteRoutineFailure, &i);
-        UCX_TEST_ASSERT(1, "the test framework fails");
-        UCX_TEST_END
-    }
+UCX_TEST(testTestSuiteRoutineNegative) {
+    int i = 0;
+    UCX_TEST_BEGIN
+    UCX_TEST_CALL_SUBROUTINE(testTestSuiteRoutineFailure, &i);
+    UCX_TEST_ASSERT(1, "the test framework fails");
+    UCX_TEST_END
+}
 
-    UCX_TEST(testTestSuiteRoutineMultiparam) {
-        UCX_TEST_BEGIN
-        UCX_TEST_CALL_SUBROUTINE(testTestSuiteRoutine2Param, 42, 3.14f);
-        UCX_TEST_END
-    }   
+UCX_TEST(testTestSuiteRoutineMultiparam) {
+    UCX_TEST_BEGIN
+    UCX_TEST_CALL_SUBROUTINE(testTestSuiteRoutine2Param, 42, 3.14f);
+    UCX_TEST_END
 }
+#ifdef __cplusplus
+}
+#endif
 
 int main(int argc, char **argv) {
     printf("UCX Tests\n---------\n");

mercurial