summaryrefslogtreecommitdiff
path: root/tests/if5-kDU.c
diff options
context:
space:
mode:
Diffstat (limited to 'tests/if5-kDU.c')
-rw-r--r--tests/if5-kDU.c64
1 files changed, 64 insertions, 0 deletions
diff --git a/tests/if5-kDU.c b/tests/if5-kDU.c
new file mode 100644
index 000000000000..2be184790ce8
--- /dev/null
+++ b/tests/if5-kDU.c
@@ -0,0 +1,64 @@
+/* Copyright 2004, 2008 Bob Proulx <bob@proulx.com>
+Distributed under the two-clause BSD licence;
+see the COPYING file for details. */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#if 0
+/* This code is commented out. "#if 0 then" */
+#else
+/* This code is passed through. "#if 0 else" */
+#endif
+
+#if 1
+/* This code is passed through. "#if 1 then" */
+#else
+/* This code is passed through. "#if 1 else" */
+#endif
+
+#if FOOB == 42
+int foo1() { return 0; }
+#else
+#error FOOB not 42
+#endif
+
+#if FOOB != 42
+#error FOO is 2
+#else
+int foo2() { return 0; }
+#endif
+
+#if FOOB == 42 || FOO == 1
+intx foo3() { return 0; }
+#else
+#error FOO not 1 or BAR not 1
+#endif
+
+#if FOOB != 42 && FOO != 1
+#error FOOB not 42 and FOO not 1
+#else
+int foo4() { return 0; }
+#endif
+
+#if FOOB == 42 || FOO != 1
+int foo5() { return 0; }
+#else
+#error FOOB is 42 or FOO is not 1
+#endif
+
+#if FOO != 1 || FOOB != 42
+#error FOO is 1 or FOOB is 42
+#else
+int foo6() { return 0; }
+#endif
+
+int main()
+{
+ foo1();
+ foo2();
+ foo3();
+ foo4();
+ foo5();
+ foo6();
+}