aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2025-08-27 22:34:13 +0900
committernsfisis <nsfisis@gmail.com>2025-08-27 22:34:13 +0900
commite12d70ba1aeada877a168977177e477e365d6801 (patch)
tree6240184d71f9c8600403226c81090492cf55b49a /tests
parentf030b6c546cc163c4b90a97aa399ffb9c1f6eeae (diff)
downloadducc-e12d70ba1aeada877a168977177e477e365d6801.tar.gz
ducc-e12d70ba1aeada877a168977177e477e365d6801.tar.zst
ducc-e12d70ba1aeada877a168977177e477e365d6801.zip
feat: support nested #if
Diffstat (limited to 'tests')
-rw-r--r--tests/102.sh128
1 files changed, 128 insertions, 0 deletions
diff --git a/tests/102.sh b/tests/102.sh
new file mode 100644
index 0000000..b323893
--- /dev/null
+++ b/tests/102.sh
@@ -0,0 +1,128 @@
+cat <<'EOF' > expected
+1
+1
+2
+2
+3
+4
+3
+4
+EOF
+
+test_diff <<'EOF'
+int printf();
+
+int main() {
+#if 1
+# if 1
+ printf("1\n");
+# else
+ printf("2\n");
+# endif
+#else
+# if 1
+ printf("3\n");
+# else
+ printf("4\n");
+# endif
+#endif
+
+#if 1
+# if 1
+ printf("1\n");
+# else
+ printf("2\n");
+# endif
+#else
+# if 0
+ printf("3\n");
+# else
+ printf("4\n");
+# endif
+#endif
+
+#if 1
+# if 0
+ printf("1\n");
+# else
+ printf("2\n");
+# endif
+#else
+# if 1
+ printf("3\n");
+# else
+ printf("4\n");
+# endif
+#endif
+
+#if 1
+# if 0
+ printf("1\n");
+# else
+ printf("2\n");
+# endif
+#else
+# if 0
+ printf("3\n");
+# else
+ printf("4\n");
+# endif
+#endif
+
+#if 0
+# if 1
+ printf("1\n");
+# else
+ printf("2\n");
+# endif
+#else
+# if 1
+ printf("3\n");
+# else
+ printf("4\n");
+# endif
+#endif
+
+#if 0
+# if 1
+ printf("1\n");
+# else
+ printf("2\n");
+# endif
+#else
+# if 0
+ printf("3\n");
+# else
+ printf("4\n");
+# endif
+#endif
+
+#if 0
+# if 0
+ printf("1\n");
+# else
+ printf("2\n");
+# endif
+#else
+# if 1
+ printf("3\n");
+# else
+ printf("4\n");
+# endif
+#endif
+
+#if 0
+# if 0
+ printf("1\n");
+# else
+ printf("2\n");
+# endif
+#else
+# if 0
+ printf("3\n");
+# else
+ printf("4\n");
+# endif
+#endif
+}
+EOF