1 /** Tests that the static initialiser code works.
2 As the init code is now clever we have to be careful.
9 #if !defined(__SDCC_pdk14) // Lack of memory
10 /*--------------------------------------------------
11 regression test for #1864582:
12 multiple definition of char cons w. --model-large
13 compile-time test only */
14 const char *c
= (const char *) "Booting";
15 /*------------------------------------------------*/
17 static {type
} smallDense
[] = {
25 #if !defined(__SDCC_pdk14) // Lack of memory
26 ASSERT (smallDense
[0] == 1);
27 ASSERT (smallDense
[1] == 2);
28 ASSERT (smallDense
[2] == 3);
29 ASSERT (smallDense
[3] == 4);
30 ASSERT (smallDense
[4] == 5);
31 ASSERT (smallDense
[5] == 6);
37 #elif defined(__SDCC_pdk14)
40 static {type
} smallSparse
[] = {
41 1, 1, 1, 1, 1, 1, 1, 1, 1
45 testSmallSparse (void)
47 #if !defined(__SDCC_pdk14) // Lack of memory
48 #if !(defined (__SDCC_pdk15) && defined(__SDCC_STACK_AUTO)) // Lack of code memory
49 ASSERT (smallSparse
[0] == 1);
50 ASSERT (smallSparse
[1] == 1);
51 ASSERT (smallSparse
[2] == 1);
52 ASSERT (smallSparse
[3] == 1);
53 ASSERT (smallSparse
[4] == 1);
54 ASSERT (smallSparse
[5] == 1);
55 ASSERT (smallSparse
[6] == 1);
56 ASSERT (smallSparse
[7] == 1);
57 ASSERT (smallSparse
[8] == 1);
64 #elif defined(__SDCC_pdk14) || defined(__SDCC_pdk15)
67 static {type
} smallSparseZero
[] = {
68 0, 0, 0, 0, 0, 0, 0, 0, 0
71 static {type
} smallSparseZeroTail
[] = {
76 testSmallSparseZero (void)
78 #if !defined(__SDCC_pdk14) && !defined(__SDCC_pdk15) // Lack of memory
79 ASSERT (smallSparseZero
[0] == 0);
80 ASSERT (smallSparseZero
[1] == 0);
81 ASSERT (smallSparseZero
[2] == 0);
82 ASSERT (smallSparseZero
[3] == 0);
83 ASSERT (smallSparseZero
[4] == 0);
84 ASSERT (smallSparseZero
[5] == 0);
85 ASSERT (smallSparseZero
[6] == 0);
86 ASSERT (smallSparseZero
[7] == 0);
87 ASSERT (smallSparseZero
[8] == 0);
88 // Make the compiler happy
89 ASSERT (smallSparseZeroTail
[0] == 1);
97 #elif defined(__SDCC_pdk14) || defined(__SDCC_pdk15)
100 static {type
} largeMixed
[] = {
101 1, 2, 3, 4, 5, 6, 7, /* 0-6 */
102 1, 1, 1, 1, 1, 1, 1, 1,
103 1, 1, 1, 1, 1, 1, 1, 1,
104 1, 1, 1, 1, 1, 1, 1, 1,
105 1, 1, 1, 1, 1, 1, 1, 1,
106 1, 1, 1, 1, 1, 1, 1, 1,
107 1, 1, 1, 1, 1, 1, 1, 1,
108 1, 1, 1, 1, 1, 1, 1, 1,
109 1, 1, 1, 1, 1, 1, 1, 1,
110 1, 1, 1, 1, 1, 1, 1, 1,
111 1, 1, 1, 1, 1, 1, 1, 1,
112 1, 1, 1, 1, 1, 1, 1, 1,
113 1, 1, 1, 1, 1, 1, 1, 1,
114 1, 1, 1, 1, 1, 1, 1, 1,
115 1, 1, 1, 1, 1, 1, 1, 1, /* 8*12 = 96+7 = -102 */
116 1, 1, 1, 1, 1, 1, 1, 1,
117 1, 1, 1, 1, 1, 1, 1, 1,
118 1, 1, 1, 1, 1, 1, 1, 1,
119 3, 4, 5, 6, 3, 4, 5, 6, /* 8*17 = 136+7 */
120 3, 4, 5, 6, 3, 4, 5, 6,
121 3, 4, 5, 6, 3, 4, 5, 6,
122 3, 4, 5, 6, 3, 4, 5, 6,
123 3, 4, 5, 6, 3, 4, 5, 6,
124 3, 4, 5, 6, 3, 4, 5, 6,
125 3, 4, 5, 6, 3, 4, 5, 6,
126 3, 4, 5, 6, 3, 4, 5, 6,
127 3, 4, 5, 6, 3, 4, 5, 6,
128 3, 4, 5, 6, 3, 4, 5, 6,
129 3, 4, 5, 6, 3, 4, 5, 6,
130 3, 4, 5, 6, 3, 4, 5, 6,
131 3, 4, 5, 6, 3, 4, 5, 6,
132 3, 4, 5, 6, 3, 4, 5, 6,
133 3, 4, 5, 6, 3, 4, 5, 6,
134 3, 4, 5, 6, 3, 4, 5, 6,
135 3, 4, 5, 6, 3, 4, 5, 6
139 testLargeMixed (void)
141 #if !defined(__SDCC_pdk14) && !defined(__SDCC_pdk15) // Lack of memory
142 ASSERT (largeMixed
[0] == 1);
143 ASSERT (largeMixed
[1] == 2);
144 ASSERT (largeMixed
[7] == 1);
145 ASSERT (largeMixed
[102] == 1);
146 ASSERT (largeMixed
[143] == 3);
147 ASSERT (largeMixed
[143+8] == 3);
148 ASSERT (largeMixed
[143+16] == 3);
149 ASSERT (largeMixed
[143+1] == 4);
150 ASSERT (largeMixed
[143+8+1] == 4);
151 ASSERT (largeMixed
[143+16+1] == 4);