aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/072.sh
blob: d82751c7f6e6603d061b921f4d25766ad22b1495 (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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
cat <<'EOF' > expected
123 456
0 0
123 456
EOF

test_diff <<'EOF'
struct S {
    int a;
    int b;
};
typedef struct S S;

void* calloc();
int printf();

int main() {
    S* s1 = calloc(1, sizeof(S));
    S* s2 = calloc(1, sizeof(S));
    s1->a = 123;
    s1->b = 456;
    printf("%d %d\n", s1->a, s1->b);
    printf("%d %d\n", s2->a, s2->b);
    *s2 = *s1;
    printf("%d %d\n", s2->a, s2->b);
}
EOF

cat <<'EOF' > expected
123 456
0 0
123 456
EOF

test_diff <<'EOF'
struct S {
    long a;
    long b;
};
typedef struct S S;

void* calloc();
int printf();

int main() {
    S* s1 = calloc(1, sizeof(S));
    S* s2 = calloc(1, sizeof(S));
    s1->a = 123;
    s1->b = 456;
    printf("%d %d\n", s1->a, s1->b);
    printf("%d %d\n", s2->a, s2->b);
    *s2 = *s1;
    printf("%d %d\n", s2->a, s2->b);
}
EOF

cat <<'EOF' > expected
123 456
0 0
123 456
EOF

test_diff <<'EOF'
struct S {
    long a;
    long b;
};
typedef struct S S;

void* calloc();
int printf();

int main() {
    S s1;
    S s2;
    s1.a = 123;
    s1.b = 456;
    s2.a = 0;
    s2.b = 0;
    printf("%d %d\n", s1.a, s1.b);
    printf("%d %d\n", s2.a, s2.b);
    s2 = s1;
    printf("%d %d\n", s2.a, s2.b);
}
EOF