test/main.c

changeset 131
fc3af16818a3
parent 123
7fb0f74517c5
child 134
4d320dc3a7af
equal deleted inserted replaced
130:633f15ce2ee4 131:fc3af16818a3
39 #include "mpool_tests.h" 39 #include "mpool_tests.h"
40 #include "map_tests.h" 40 #include "map_tests.h"
41 #include "prop_tests.h" 41 #include "prop_tests.h"
42 #include "buffer_tests.h" 42 #include "buffer_tests.h"
43 43
44 UCX_TEST_IMPLEMENT(testTestSuitePositive) { 44 UCX_EXTERN UCX_TEST_IMPLEMENT(testTestSuitePositive) {
45 UCX_TEST_BEGIN 45 UCX_TEST_BEGIN
46 UCX_TEST_ASSERT(2*2 == 4, "the test framework fails"); 46 UCX_TEST_ASSERT(2*2 == 4, "the test framework fails");
47 UCX_TEST_END 47 UCX_TEST_END
48 } 48 }
49 49
50 UCX_TEST_IMPLEMENT(testTestSuiteNegative) { 50 UCX_EXTERN UCX_TEST_IMPLEMENT(testTestSuiteNegative) {
51 UCX_TEST_BEGIN 51 UCX_TEST_BEGIN
52 UCX_TEST_ASSERT(2*(-2) == 4, "the test framework works"); 52 UCX_TEST_ASSERT(2*(-2) == 4, "the test framework works");
53 UCX_TEST_END 53 UCX_TEST_END
54 } 54 }
55 55
56 UCX_TEST_SUBROUTINE(testTestSuiteRoutineRoutine, float f) { 56 UCX_EXTERN UCX_TEST_SUBROUTINE(testTestSuiteRoutineRoutine, float f) {
57 UCX_TEST_ASSERT(f == 3.14f, "calling routine in a routine fails"); 57 UCX_TEST_ASSERT(f == 3.14f, "calling routine in a routine fails");
58 } 58 }
59 59
60 UCX_TEST_SUBROUTINE(testTestSuiteRoutine2Param, int i, float f) { 60 UCX_EXTERN UCX_TEST_SUBROUTINE(testTestSuiteRoutine2Param, int i, float f) {
61 UCX_TEST_ASSERT(i == 42, "two parameter routine fails"); 61 UCX_TEST_ASSERT(i == 42, "two parameter routine fails");
62 UCX_TEST_CALL_SUBROUTINE(testTestSuiteRoutineRoutine, f); 62 UCX_TEST_CALL_SUBROUTINE(testTestSuiteRoutineRoutine, f);
63 } 63 }
64 64
65 UCX_TEST_SUBROUTINE(testTestSuiteRoutineSuccess, int* i) { 65 UCX_EXTERN UCX_TEST_SUBROUTINE(testTestSuiteRoutineSuccess, int* i) {
66 *i += 2; 66 *i += 2;
67 UCX_TEST_ASSERT(*i==4, "the test framework fails"); 67 UCX_TEST_ASSERT(*i==4, "the test framework fails");
68 } 68 }
69 69
70 UCX_TEST_SUBROUTINE(testTestSuiteRoutineFailure, int* i) { 70 UCX_EXTERN UCX_TEST_SUBROUTINE(testTestSuiteRoutineFailure, int* i) {
71 *i += 2; 71 *i += 2;
72 // Next test shall fail! 72 // Next test shall fail!
73 UCX_TEST_ASSERT(*i==4, "the test framework works"); 73 UCX_TEST_ASSERT(*i==4, "the test framework works");
74 } 74 }
75 75
76 UCX_TEST_IMPLEMENT(testTestSuiteRoutinePositive) { 76 UCX_EXTERN UCX_TEST_IMPLEMENT(testTestSuiteRoutinePositive) {
77 int i = 2; 77 int i = 2;
78 UCX_TEST_BEGIN 78 UCX_TEST_BEGIN
79 UCX_TEST_CALL_SUBROUTINE(testTestSuiteRoutineSuccess, &i); 79 UCX_TEST_CALL_SUBROUTINE(testTestSuiteRoutineSuccess, &i);
80 UCX_TEST_ASSERT(i==4, "the test framework fails"); 80 UCX_TEST_ASSERT(i==4, "the test framework fails");
81 UCX_TEST_END 81 UCX_TEST_END
82 } 82 }
83 83
84 UCX_TEST_IMPLEMENT(testTestSuiteRoutineNegative) { 84 UCX_EXTERN UCX_TEST_IMPLEMENT(testTestSuiteRoutineNegative) {
85 int i = 0; 85 int i = 0;
86 UCX_TEST_BEGIN 86 UCX_TEST_BEGIN
87 UCX_TEST_CALL_SUBROUTINE(testTestSuiteRoutineFailure, &i); 87 UCX_TEST_CALL_SUBROUTINE(testTestSuiteRoutineFailure, &i);
88 UCX_TEST_ASSERT(1, "the test framework fails"); 88 UCX_TEST_ASSERT(1, "the test framework fails");
89 UCX_TEST_END 89 UCX_TEST_END
90 } 90 }
91 91
92 UCX_TEST_IMPLEMENT(testTestSuiteRoutineMultiparam) { 92 UCX_EXTERN UCX_TEST_IMPLEMENT(testTestSuiteRoutineMultiparam) {
93 UCX_TEST_BEGIN 93 UCX_TEST_BEGIN
94 UCX_TEST_CALL_SUBROUTINE(testTestSuiteRoutine2Param, 42, 3.14f); 94 UCX_TEST_CALL_SUBROUTINE(testTestSuiteRoutine2Param, 42, 3.14f);
95 UCX_TEST_END 95 UCX_TEST_END
96 } 96 }
97 97

mercurial