diff options
Diffstat (limited to 'tests/test_enums.sh')
| -rw-r--r-- | tests/test_enums.sh | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/tests/test_enums.sh b/tests/test_enums.sh new file mode 100644 index 0000000..228786a --- /dev/null +++ b/tests/test_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 +EOF + +test_diff <<'EOF' +int printf(); + +enum E1 { + A = 10, + B, + C = 20, + D, +}; + +enum E2 { + E, + F = 5, + G +}; + +int main() { + printf("%d,%d,%d,%d\n", A, B, C, D); + printf("%d,%d,%d\n", E, F, G); +} +EOF + |
