|
12 | 12 |
|
13 | 13 | '' split the test so we can modify test generation here separately |
14 | 14 |
|
15 | | -SUITE( fbc_tests.compound.select_const ) |
| 15 | +SUITE( fbc_tests.compound.select_const2 ) |
16 | 16 |
|
17 | 17 | const FALSE = 0 |
18 | 18 | const TRUE = not FALSE |
19 | 19 |
|
20 | | - TEST( RangeEdges ) |
21 | | - |
22 | | - dim as integer ok, nok |
23 | | - |
24 | | - #macro TEST_RANGE( T, a, b, c_, d_, p, f ) |
25 | | - scope |
| 20 | + #macro TEST_RANGE( T, a, b, c_, d_, p, f ) |
| 21 | + #if DEFINITION = TRUE |
| 22 | + __fb_uniqueid_push__( callstack ) |
| 23 | + sub __fb_uniqueid__( callstack ) |
| 24 | + dim as integer ok, nok |
26 | 25 | ok = 0 |
27 | 26 | nok = 0 |
28 | 27 | dim v as T |
@@ -50,10 +49,15 @@ SUITE( fbc_tests.compound.select_const ) |
50 | 49 | loop |
51 | 50 | CU_ASSERT_EQUAL( p, ok ) |
52 | 51 | CU_ASSERT_EQUAL( f, nok ) |
53 | | - end scope |
54 | | - #endmacro |
55 | | - |
56 | | - #macro TEST_RANGE_EDGES( T, a, b ) |
| 52 | + end sub |
| 53 | + #else |
| 54 | + '' call the test - the order doesn't matter |
| 55 | + __fb_uniqueid__( callstack )() |
| 56 | + __fb_uniqueid_pop__( callstack ) |
| 57 | + #endif |
| 58 | + #endmacro |
| 59 | + |
| 60 | + #macro TEST_RANGE_EDGES( T, a, b ) |
57 | 61 | TEST_RANGE( T, a+0, a+10, a+0, a+0, 1, 10 ) |
58 | 62 | TEST_RANGE( T, a+0, a+10, a+0, a+1, 2, 9 ) |
59 | 63 | TEST_RANGE( T, a+0, a+10, a+1, a+1, 1, 10 ) |
@@ -85,9 +89,9 @@ SUITE( fbc_tests.compound.select_const ) |
85 | 89 | TEST_RANGE( T, b-10, b-1, b-1, b-1, 1, 9 ) |
86 | 90 | TEST_RANGE( T, b-10, b-1, b-2, b-1, 2, 8 ) |
87 | 91 | TEST_RANGE( T, b-10, b-1, b-2, b-2, 1, 9 ) |
88 | | - #endmacro |
| 92 | + #endmacro |
89 | 93 |
|
90 | | - #macro TEST_RANGES() |
| 94 | + #macro TEST_RANGES() |
91 | 95 | '' byte range edges and near zero |
92 | 96 | TEST_RANGE_EDGES( byte, -128, 127 ) |
93 | 97 | TEST_RANGE_EDGES( byte, -2, 2 ) |
@@ -139,17 +143,35 @@ SUITE( fbc_tests.compound.select_const ) |
139 | 143 | TEST_RANGE_EDGES( longint, -9223372036854775807ll-1ll, 9223372036854775807ll ) |
140 | 144 | TEST_RANGE_EDGES( longint, -2ll, 2ll ) |
141 | 145 | TEST_RANGE_EDGES( ulongint, 0, 18446744073709551615ull ) |
142 | | - #endmacro |
143 | | - |
144 | | - '' Test Ranges using literal values |
145 | | - #define LITERAL TRUE |
| 146 | + #endmacro |
| 147 | + |
| 148 | + '' generate tests for Test Ranges using literal values |
| 149 | + #define LITERAL TRUE |
| 150 | + #undef DEFINITION |
| 151 | + #define DEFINITION TRUE |
| 152 | + TEST_RANGES() |
| 153 | + |
| 154 | + '' call the tests - the order doesn't matter, only that we use & call |
| 155 | + '' the correct number of calls from the callstack |
| 156 | + #undef DEFINITION |
| 157 | + #define DEFINITION FALSE |
| 158 | + TEST( RangeEdges_literal ) |
146 | 159 | TEST_RANGES() |
| 160 | + END_TEST |
147 | 161 |
|
148 | | - '' Test Ranges using a CONST symbol |
149 | | - #undef LITERAL |
150 | | - #define LITERAL FALSE |
| 162 | + '' generate tests for Test Ranges using a CONST symbol |
| 163 | + #undef LITERAL |
| 164 | + #define LITERAL FALSE |
| 165 | + #undef DEFINITION |
| 166 | + #define DEFINITION TRUE |
| 167 | + TEST_RANGES() |
| 168 | + |
| 169 | + '' call the tests - the order doesn't matter, only that we use & call |
| 170 | + '' the correct number of calls from the callstack |
| 171 | + #undef DEFINITION |
| 172 | + #define DEFINITION FALSE |
| 173 | + TEST( RangeEdges_const ) |
151 | 174 | TEST_RANGES() |
152 | | - |
153 | 175 | END_TEST |
154 | 176 |
|
155 | 177 | END_SUITE |
0 commit comments