summaryrefslogtreecommitdiff
path: root/tests/switch-case.c
diff options
context:
space:
mode:
Diffstat (limited to 'tests/switch-case.c')
-rw-r--r--tests/switch-case.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/switch-case.c b/tests/switch-case.c
new file mode 100644
index 0000000..03d9bdc
--- /dev/null
+++ b/tests/switch-case.c
@@ -0,0 +1,21 @@
+int f(int n) {
+ switch (n) {
+ case 1:
+ case 2:
+ return 1;
+ case 3:
+ return 3;
+ case 4:
+ break;
+ default:
+ return 5;
+ }
+ return 4;
+}
+
+int main() {
+ int a;
+ // 1 + 1 + 3 + 4 + 5 = 14
+ a = f(1) + f(2) + f(3) + f(4) + f(5);
+ return a;// 14, 0xe
+}