about summary refs log tree commit diff homepage
path: root/test/Feature/DeterministicSwitch.c
diff options
context:
space:
mode:
authorMartinNowack <martin.nowack@gmail.com>2016-07-08 22:53:05 +0200
committerGitHub <noreply@github.com>2016-07-08 22:53:05 +0200
commitf4363713c97769f392b7d85c4782f6e1aeb1a137 (patch)
tree39fd16ed9917fe921b838771054a630fe3bcefef /test/Feature/DeterministicSwitch.c
parent784bbc141946e9c77849cbba13563fd8d0b27c0f (diff)
parent91af7cdc0521a155a050976eaa8856f04a576826 (diff)
downloadklee-f4363713c97769f392b7d85c4782f6e1aeb1a137.tar.gz
Merge pull request #362 from MartinNowack/feat_determ_state_selection
Deterministic state addition and removing
Diffstat (limited to 'test/Feature/DeterministicSwitch.c')
-rw-r--r--test/Feature/DeterministicSwitch.c38
1 files changed, 38 insertions, 0 deletions
diff --git a/test/Feature/DeterministicSwitch.c b/test/Feature/DeterministicSwitch.c
new file mode 100644
index 00000000..b6c186ff
--- /dev/null
+++ b/test/Feature/DeterministicSwitch.c
@@ -0,0 +1,38 @@
+// 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 '\t':
+    printf("tab\n");
+    break;
+  case ' ':
+    printf("space\n");
+    break;
+  default:
+    printf("default\n");
+    break;
+  }
+
+  // CHECK-DFS: default
+  // CHECK-DFS: space
+  // CHECK-DFS: tab
+
+  // CHECK-BFS: tab
+  // CHECK-BFS: space
+  // CHECK-BFS: default
+
+  return 0;
+}