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
86
87
88
89
90
91
92
|
cat <<'EOF' > expected
EOF
test_diff <<'EOF'
#define A 1
int main() {
return 0;
}
EOF
cat <<'EOF' > expected
1,2,3
EOF
test_diff <<'EOF'
int printf();
#define A 1
#define B 2
#define C 3
int main() {
printf("%d,%d,%d\n", A, B, C);
return 0;
}
EOF
cat <<'EOF' > expected
0,0,0,0
EOF
test_diff <<'EOF'
int printf();
#define NULL 0
#define TK_EOF 0
#define TY_UNKNOWN 0
#define AST_UNKNOWN 0
int main() {
printf("%d,%d,%d,%d\n", NULL, TK_EOF, TY_UNKNOWN, AST_UNKNOWN);
return 0;
}
EOF
cat <<'EOF' > expected
42,123
EOF
test_diff <<'EOF'
int printf();
#define A foo_a
#define B foo_b
int main() {
int foo_a = 42;
int foo_b = 123;
printf("%d,%d\n", A, B);
return 0;
}
EOF
cat <<'EOF' > expected
123
EOF
test_diff <<'EOF'
#define foo() 123
int printf();
int main() {
printf("%d\n", foo());
}
EOF
cat <<'EOF' > expected
579
975
EOF
test_diff <<'EOF'
#define foo 123 + 456
#define bar() 321 + 654
int printf();
int main() {
printf("%d\n", foo);
printf("%d\n", bar());
}
EOF
|