]> git.sur5r.net Git - cc65/commitdiff
Now testing switch statements with empty bodies.
authorChris Cacciatore <chris.cacciatore@gmail.com>
Mon, 15 Aug 2016 18:36:50 +0000 (11:36 -0700)
committerChris Cacciatore <chris.cacciatore@gmail.com>
Mon, 15 Aug 2016 18:36:50 +0000 (11:36 -0700)
test/val/switch2.c [new file with mode: 0644]

diff --git a/test/val/switch2.c b/test/val/switch2.c
new file mode 100644 (file)
index 0000000..00206b0
--- /dev/null
@@ -0,0 +1,39 @@
+/*
+  !!DESCRIPTION!! Testing empty bodied switch statements.
+  !!ORIGIN!!      
+  !!LICENCE!!     GPL, read COPYING.GPL
+*/
+
+#include <stdio.h>
+
+unsigned char success=0;
+unsigned char failures=0;
+unsigned char dummy=0;
+
+void done()
+{
+  dummy++;
+}
+
+void switch_no_body(void)
+{
+  switch(0);
+}
+
+void switch_empty_body(void)
+{
+  switch(0) {};
+}
+
+/* only worried about this file compiling successfully */
+int main(void)
+{
+  switch_no_body();
+  switch_empty_body();
+
+  success=failures;
+  done();
+  printf("failures: %d\n",failures);
+
+  return failures;
+}