Skip to content

Commit 2343df4

Browse files
committed
fbc-tests: split tests/compound/select_const.bas in to 2 test files
- prepare for changes to the select const tests causing problems compiling with the gcc backend - the test will generate a very large C listing (250K+ LOC with debugging enabled) with most of the asserts in a single procedure - with debug symbols enabled, gcc can run out of memory overflowing the symbol hash tables - and the test is very taxing on the gcc optimizer (-O1 or higher) resulting in a very slow compile time
1 parent 4d19e26 commit 2343df4

File tree

1 file changed

+43
-21
lines changed

1 file changed

+43
-21
lines changed

tests/compound/select_const2.bas

Lines changed: 43 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,16 @@
1212

1313
'' split the test so we can modify test generation here separately
1414

15-
SUITE( fbc_tests.compound.select_const )
15+
SUITE( fbc_tests.compound.select_const2 )
1616

1717
const FALSE = 0
1818
const TRUE = not FALSE
1919

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
2625
ok = 0
2726
nok = 0
2827
dim v as T
@@ -50,10 +49,15 @@ SUITE( fbc_tests.compound.select_const )
5049
loop
5150
CU_ASSERT_EQUAL( p, ok )
5251
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 )
5761
TEST_RANGE( T, a+0, a+10, a+0, a+0, 1, 10 )
5862
TEST_RANGE( T, a+0, a+10, a+0, a+1, 2, 9 )
5963
TEST_RANGE( T, a+0, a+10, a+1, a+1, 1, 10 )
@@ -85,9 +89,9 @@ SUITE( fbc_tests.compound.select_const )
8589
TEST_RANGE( T, b-10, b-1, b-1, b-1, 1, 9 )
8690
TEST_RANGE( T, b-10, b-1, b-2, b-1, 2, 8 )
8791
TEST_RANGE( T, b-10, b-1, b-2, b-2, 1, 9 )
88-
#endmacro
92+
#endmacro
8993

90-
#macro TEST_RANGES()
94+
#macro TEST_RANGES()
9195
'' byte range edges and near zero
9296
TEST_RANGE_EDGES( byte, -128, 127 )
9397
TEST_RANGE_EDGES( byte, -2, 2 )
@@ -139,17 +143,35 @@ SUITE( fbc_tests.compound.select_const )
139143
TEST_RANGE_EDGES( longint, -9223372036854775807ll-1ll, 9223372036854775807ll )
140144
TEST_RANGE_EDGES( longint, -2ll, 2ll )
141145
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 )
146159
TEST_RANGES()
160+
END_TEST
147161

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 )
151174
TEST_RANGES()
152-
153175
END_TEST
154176

155177
END_SUITE

0 commit comments

Comments
 (0)