aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/test_enums.sh
blob: 3fc15a0e054c3b23ae1369e52823bba8018b4430 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
cat <<'EOF' > expected
4
0,1,2
EOF
test_diff <<'EOF'
int printf();

enum E {
    A,
    B,
    C,
};

int main() {
    enum E x = A;
    printf("%d\n", sizeof(enum E));
    printf("%d,%d,%d\n", A, B, C);
    return 0;
}
EOF

cat <<'EOF' > expected
10,11,20,21
0,5,6,6
EOF

test_diff <<'EOF'
int printf();

enum E1 {
    A = 10,
    B,
    C = 20,
    D,
};

enum E2 {
    E,
    F = 5,
    G,
    H = G,
};

int main() {
    printf("%d,%d,%d,%d\n", A, B, C, D);
    printf("%d,%d,%d,%d\n", E, F, G, H);
}
EOF