aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/033.sh
blob: 1fb92ac845d65c420b2bc0c79e91856ab7c92e6d (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
set -e

cat <<'EOF' > expected
42
EOF
bash ../../test_diff.sh <<'EOF'
int printf();
void* calloc();

int main() {
    int b;
    int* a = &b;
    a[0] = 42;
    printf("%d\n", *a);
    return 0;
}
EOF

cat <<'EOF' > expected
0 0
1 1
2 2
3 3
4 4
5 5
6 6
7 7
8 8
9 9
EOF
bash ../../test_diff.sh <<'EOF'
int printf();
void* calloc();

int main() {
    long* a = calloc(10, sizeof(long));
    long i = 0;
    for (i = 0; i < 10; i = i + 1) {
        a[i] = i;
    }
    for (i = 0; i < 10; i = i + 1) {
        printf("%d %d\n", *(a + i), a[i]);
    }
    return 0;
}
EOF