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);
23 static {type} smallSparse[] = {
24 1, 1, 1, 1, 1, 1, 1, 1, 1
30 ASSERT(smallSparse[0] == 1);
31 ASSERT(smallSparse[1] == 1);
32 ASSERT(smallSparse[2] == 1);
33 ASSERT(smallSparse[3] == 1);
34 ASSERT(smallSparse[4] == 1);
35 ASSERT(smallSparse[5] == 1);
36 ASSERT(smallSparse[6] == 1);
37 ASSERT(smallSparse[7] == 1);
38 ASSERT(smallSparse[8] == 1);
41 static {type} smallSparseZero[] = {
42 0, 0, 0, 0, 0, 0, 0, 0, 0
45 static {type} smallSparseZeroTail[] = {
50 testSmallSparseZero(void)
52 ASSERT(smallSparseZero[0] == 0);
53 ASSERT(smallSparseZero[1] == 0);
54 ASSERT(smallSparseZero[2] == 0);
55 ASSERT(smallSparseZero[3] == 0);
56 ASSERT(smallSparseZero[4] == 0);
57 ASSERT(smallSparseZero[5] == 0);
58 ASSERT(smallSparseZero[6] == 0);
59 ASSERT(smallSparseZero[7] == 0);
60 ASSERT(smallSparseZero[8] == 0);
63 static {type} largeMixed[] = {
64 1, 2, 3, 4, 5, 6, 7, /* 0-6 */
65 1, 1, 1, 1, 1, 1, 1, 1,
66 1, 1, 1, 1, 1, 1, 1, 1,
67 1, 1, 1, 1, 1, 1, 1, 1,
68 1, 1, 1, 1, 1, 1, 1, 1,
69 1, 1, 1, 1, 1, 1, 1, 1,
70 1, 1, 1, 1, 1, 1, 1, 1,
71 1, 1, 1, 1, 1, 1, 1, 1,
72 1, 1, 1, 1, 1, 1, 1, 1,
73 1, 1, 1, 1, 1, 1, 1, 1,
74 1, 1, 1, 1, 1, 1, 1, 1,
75 1, 1, 1, 1, 1, 1, 1, 1,
76 1, 1, 1, 1, 1, 1, 1, 1,
77 1, 1, 1, 1, 1, 1, 1, 1,
78 1, 1, 1, 1, 1, 1, 1, 1, /* 8*12 = 96+7 = -102 */
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 3, 4, 5, 6, 3, 4, 5, 6, /* 8*17 = 136+7 */
83 3, 4, 5, 6, 3, 4, 5, 6,
84 3, 4, 5, 6, 3, 4, 5, 6,
85 3, 4, 5, 6, 3, 4, 5, 6,
86 3, 4, 5, 6, 3, 4, 5, 6,
87 3, 4, 5, 6, 3, 4, 5, 6,
88 3, 4, 5, 6, 3, 4, 5, 6,
89 3, 4, 5, 6, 3, 4, 5, 6,
90 3, 4, 5, 6, 3, 4, 5, 6,
91 3, 4, 5, 6, 3, 4, 5, 6,
92 3, 4, 5, 6, 3, 4, 5, 6,
93 3, 4, 5, 6, 3, 4, 5, 6,
94 3, 4, 5, 6, 3, 4, 5, 6,
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
104 ASSERT(largeMixed[0] == 1);
105 ASSERT(largeMixed[1] == 2);
106 ASSERT(largeMixed[7] == 1);
107 ASSERT(largeMixed[102] == 1);
108 ASSERT(largeMixed[143] == 3);
109 ASSERT(largeMixed[143+8] == 3);
110 ASSERT(largeMixed[143+16] == 3);
111 ASSERT(largeMixed[143+1] == 4);
112 ASSERT(largeMixed[143+8+1] == 4);
113 ASSERT(largeMixed[143+16+1] == 4);