about summary refs log tree commit diff homepage
path: root/test/Feature
diff options
context:
space:
mode:
authorMartin Nowack <martin@se.inf.tu-dresden.de>2016-03-22 16:39:28 +0100
committerMartin Nowack <martin@se.inf.tu-dresden.de>2016-07-08 21:56:28 +0200
commitf3ff3b06318cae93db4d682e6451ddbca4760328 (patch)
treeb984df4d0ab09629ef423831f542ff746ff8e34c /test/Feature
parent07632e75e21e3c61f1ab46f76618cb1b807bd6c3 (diff)
downloadklee-f3ff3b06318cae93db4d682e6451ddbca4760328.tar.gz
Use vector instead of set to add/remove states
Deterministic adding/removing of states.
Diffstat (limited to 'test/Feature')
-rw-r--r--test/Feature/DeterministicSwitch.c41
1 files changed, 41 insertions, 0 deletions
diff --git a/test/Feature/DeterministicSwitch.c b/test/Feature/DeterministicSwitch.c
new file mode 100644
index 00000000..0768576c
--- /dev/null
+++ b/test/Feature/DeterministicSwitch.c
@@ -0,0 +1,41 @@
+// The order cases are generated in LLVM 2.9 is different: tab first then space
+// as one can see in assembly.ll, skip this test for older versions
+// REQUIRES: not-llvm-2.9
+// RUN: %llvmgcc %s -emit-llvm -g -c -o %t.bc
+// RUN: rm -rf %t.klee-out
+// RUN: %klee -debug-print-instructions=all:stderr --output-dir=%t.klee-out --allow-external-sym-calls --switch-type=internal --search=dfs %t.bc >%t.switch.log 2>&1
+// RUN: FileCheck %s -input-file=%t.switch.log -check-prefix=CHECK-DFS
+// RUN: rm -rf %t.klee-out
+// RUN: %klee -debug-print-instructions=all:stderr --output-dir=%t.klee-out --allow-external-sym-calls --switch-type=internal --search=bfs %t.bc >%t.switch.log 2>&1
+// RUN: FileCheck %s -input-file=%t.switch.log -check-prefix=CHECK-BFS
+
+#include "klee/klee.h"
+#include <stdio.h>
+
+int main(int argc, char **argv) {
+  char c;
+
+  klee_make_symbolic(&c, sizeof(c), "index");
+
+  switch (c) {
+  case ' ':
+    printf("space\n");
+    break;
+  case '\t':
+    printf("tab\n");
+    break;
+  default:
+    printf("default\n");
+    break;
+  }
+
+  // CHECK-DFS: default
+  // CHECK-DFS: tab
+  // CHECK-DFS: space
+
+  // CHECK-BFS: space
+  // CHECK-BFS: tab
+  // CHECK-BFS: default
+
+  return 0;
+}