1 /** Tests that the static initialiser code works.
2 As the init code is now clever we have to be careful.
9 static {type} smallDense[] = {
16 ASSERT(smallDense[0] == 1);
17 ASSERT(smallDense[1] == 2);
18 ASSERT(smallDense[2] == 3);
19 ASSERT(smallDense[3] == 4);
20 ASSERT(smallDense[4] == 5);
21 ASSERT(smallDense[5] == 6);
25 idata at 0xa0 /* leave space for the stack */
27 static {type} smallSparse[] = {
28 1, 1, 1, 1, 1, 1, 1, 1, 1
34 ASSERT(smallSparse[0] == 1);
35 ASSERT(smallSparse[1] == 1);
36 ASSERT(smallSparse[2] == 1);
37 ASSERT(smallSparse[3] == 1);
38 ASSERT(smallSparse[4] == 1);
39 ASSERT(smallSparse[5] == 1);
40 ASSERT(smallSparse[6] == 1);
41 ASSERT(smallSparse[7] == 1);
42 ASSERT(smallSparse[8] == 1);
48 static {type} smallSparseZero[] = {
49 0, 0, 0, 0, 0, 0, 0, 0, 0
52 static {type} smallSparseZeroTail[] = {
57 testSmallSparseZero(void)
59 ASSERT(smallSparseZero[0] == 0);
60 ASSERT(smallSparseZero[1] == 0);
61 ASSERT(smallSparseZero[2] == 0);
62 ASSERT(smallSparseZero[3] == 0);
63 ASSERT(smallSparseZero[4] == 0);
64 ASSERT(smallSparseZero[5] == 0);
65 ASSERT(smallSparseZero[6] == 0);
66 ASSERT(smallSparseZero[7] == 0);
67 ASSERT(smallSparseZero[8] == 0);
69 // Make the compiler happy
70 ASSERT(smallSparseZeroTail[0] == 1);
78 static {type} largeMixed[] = {
79 1, 2, 3, 4, 5, 6, 7, /* 0-6 */
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,
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, /* 8*12 = 96+7 = -102 */
94 1, 1, 1, 1, 1, 1, 1, 1,
95 1, 1, 1, 1, 1, 1, 1, 1,
96 1, 1, 1, 1, 1, 1, 1, 1,
97 3, 4, 5, 6, 3, 4, 5, 6, /* 8*17 = 136+7 */
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,
111 3, 4, 5, 6, 3, 4, 5, 6,
112 3, 4, 5, 6, 3, 4, 5, 6,
113 3, 4, 5, 6, 3, 4, 5, 6
119 ASSERT(largeMixed[0] == 1);
120 ASSERT(largeMixed[1] == 2);
121 ASSERT(largeMixed[7] == 1);
122 ASSERT(largeMixed[102] == 1);
123 ASSERT(largeMixed[143] == 3);
124 ASSERT(largeMixed[143+8] == 3);
125 ASSERT(largeMixed[143+16] == 3);
126 ASSERT(largeMixed[143+1] == 4);
127 ASSERT(largeMixed[143+8+1] == 4);
128 ASSERT(largeMixed[143+16+1] == 4);