projects
/
libfirm
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
c569e73
)
switch is still broken, copying over cparser testcase since noone runs the cparser...
author
Matthias Braun
<matze@braunis.de>
Sat, 1 Nov 2008 16:56:55 +0000
(16:56 +0000)
committer
Matthias Braun
<matze@braunis.de>
Sat, 1 Nov 2008 16:56:55 +0000
(16:56 +0000)
[r23350]
ir/be/test/switch.c
[new file with mode: 0644]
patch
|
blob
diff --git a/ir/be/test/switch.c
b/ir/be/test/switch.c
new file mode 100644
(file)
index 0000000..
5308137
--- /dev/null
+++ b/
ir/be/test/switch.c
@@ -0,0
+1,29
@@
+#include <assert.h>
+#include <limits.h>
+
+static int switch1(int k) {
+ switch(k) {
+ case 42:
+ return 5;
+ case 13:
+ return 7;
+ case INT_MAX:
+ return 8;
+ case -1:
+ case INT_MIN:
+ return 9;
+ }
+ return 3;
+}
+
+int main(void)
+{
+ assert(switch1(42) == 5);
+ assert(switch1(13) == 7);
+ assert(switch1(-1) == 9);
+ assert(switch1(700) == 3);
+ assert(switch1(-32000) == 3);
+ assert(switch1(INT_MAX) == 8);
+ assert(switch1(INT_MIN) == 9);
+ return 0;
+}