diff options
Diffstat (limited to 'tests/enums.sh')
| -rw-r--r-- | tests/enums.sh | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/tests/enums.sh b/tests/enums.sh new file mode 100644 index 0000000..3fc15a0 --- /dev/null +++ b/tests/enums.sh @@ -0,0 +1,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 |
