1 /** Tests that the static initialiser code works.
2 As the init code is now clever we have to be careful.
8 static {type} smallDense[] = {
15 ASSERT(smallDense[0] == 1);
16 ASSERT(smallDense[1] == 2);
17 ASSERT(smallDense[2] == 3);
18 ASSERT(smallDense[3] == 4);
19 ASSERT(smallDense[4] == 5);
20 ASSERT(smallDense[5] == 6);
24 idata at 0xa0 /* leave space for the stack */
26 static {type} smallSparse[] = {
27 1, 1, 1, 1, 1, 1, 1, 1, 1
33 ASSERT(smallSparse[0] == 1);
34 ASSERT(smallSparse[1] == 1);
35 ASSERT(smallSparse[2] == 1);
36 ASSERT(smallSparse[3] == 1);
37 ASSERT(smallSparse[4] == 1);
38 ASSERT(smallSparse[5] == 1);
39 ASSERT(smallSparse[6] == 1);
40 ASSERT(smallSparse[7] == 1);
41 ASSERT(smallSparse[8] == 1);
47 static {type} smallSparseZero[] = {
48 0, 0, 0, 0, 0, 0, 0, 0, 0
51 static {type} smallSparseZeroTail[] = {
56 testSmallSparseZero(void)
58 ASSERT(smallSparseZero[0] == 0);
59 ASSERT(smallSparseZero[1] == 0);
60 ASSERT(smallSparseZero[2] == 0);
61 ASSERT(smallSparseZero[3] == 0);
62 ASSERT(smallSparseZero[4] == 0);
63 ASSERT(smallSparseZero[5] == 0);
64 ASSERT(smallSparseZero[6] == 0);
65 ASSERT(smallSparseZero[7] == 0);
66 ASSERT(smallSparseZero[8] == 0);
68 // Make the compiler happy
69 ASSERT(smallSparseZeroTail[0] == 1);
75 static {type} largeMixed[] = {
76 1, 2, 3, 4, 5, 6, 7, /* 0-6 */
77 1, 1, 1, 1, 1, 1, 1, 1,
78 1, 1, 1, 1, 1, 1, 1, 1,
79 1, 1, 1, 1, 1, 1, 1, 1,
80 1, 1, 1, 1, 1, 1, 1, 1,
81 1, 1, 1, 1, 1, 1, 1, 1,
82 1, 1, 1, 1, 1, 1, 1, 1,
83 1, 1, 1, 1, 1, 1, 1, 1,
84 1, 1, 1, 1, 1, 1, 1, 1,
85 1, 1, 1, 1, 1, 1, 1, 1,
86 1, 1, 1, 1, 1, 1, 1, 1,
87 1, 1, 1, 1, 1, 1, 1, 1,
88 1, 1, 1, 1, 1, 1, 1, 1,
89 1, 1, 1, 1, 1, 1, 1, 1,
90 1, 1, 1, 1, 1, 1, 1, 1, /* 8*12 = 96+7 = -102 */
91 1, 1, 1, 1, 1, 1, 1, 1,
92 1, 1, 1, 1, 1, 1, 1, 1,
93 1, 1, 1, 1, 1, 1, 1, 1,
94 3, 4, 5, 6, 3, 4, 5, 6, /* 8*17 = 136+7 */
95 3, 4, 5, 6, 3, 4, 5, 6,
96 3, 4, 5, 6, 3, 4, 5, 6,
97 3, 4, 5, 6, 3, 4, 5, 6,
98 3, 4, 5, 6, 3, 4, 5, 6,
99 3, 4, 5, 6, 3, 4, 5, 6,
100 3, 4, 5, 6, 3, 4, 5, 6,
101 3, 4, 5, 6, 3, 4, 5, 6,
102 3, 4, 5, 6, 3, 4, 5, 6,
103 3, 4, 5, 6, 3, 4, 5, 6,
104 3, 4, 5, 6, 3, 4, 5, 6,
105 3, 4, 5, 6, 3, 4, 5, 6,
106 3, 4, 5, 6, 3, 4, 5, 6,
107 3, 4, 5, 6, 3, 4, 5, 6,
108 3, 4, 5, 6, 3, 4, 5, 6,
109 3, 4, 5, 6, 3, 4, 5, 6,
110 3, 4, 5, 6, 3, 4, 5, 6
116 ASSERT(largeMixed[0] == 1);
117 ASSERT(largeMixed[1] == 2);
118 ASSERT(largeMixed[7] == 1);
119 ASSERT(largeMixed[102] == 1);
120 ASSERT(largeMixed[143] == 3);
121 ASSERT(largeMixed[143+8] == 3);
122 ASSERT(largeMixed[143+16] == 3);
123 ASSERT(largeMixed[143+1] == 4);
124 ASSERT(largeMixed[143+8+1] == 4);
125 ASSERT(largeMixed[143+16+1] == 4);