]> pd.if.org Git - lice/blob - tests/global.c
autocommit for files dated 2014-11-17 20:13:36
[lice] / tests / global.c
1 // global variables
2
3 int  a = 1024;
4 int *b = &a;
5
6 int  c[10];
7 int  d[10] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
8
9 int  e, f;
10 int  g, h = 10;
11 int  i = 11, j;
12
13 char  k[] = "hello";
14 char *l   = "world";
15
16 long m  = 32;
17 int *n  = &(int) { 64 };
18
19 int main(void) {
20     expecti(a, 1024);
21
22     // can write to global?
23     a = 2048;
24     expecti(a, 2048);
25     expecti(*b, 2048);
26
27     c[1] = 2;
28     expecti(c[1], 2);
29     expecti(d[1], 2);
30
31     e = 7;
32     f = 8;
33     expecti(e, 7);
34     expecti(f, 8);
35     g = 9;
36     expecti(g, 9);
37     expecti(h, 10);
38     expecti(i, 11);
39     j = 12;
40     expecti(j, 12);
41
42     expectstr(k, "hello");
43     expectstr(l, "world");
44
45     expectl(m, 32);
46     expectl(*n, 64);
47
48     return 0;
49 }