about summary refs log tree commit diff homepage
path: root/test
diff options
context:
space:
mode:
authorCristian Cadar <c.cadar@imperial.ac.uk>2021-12-23 21:37:46 +0000
committerMartinNowack <2443641+MartinNowack@users.noreply.github.com>2022-01-05 10:57:23 +0000
commit04646910ca0fc5a4b08d9a6cdc3cd8c8ae5419ee (patch)
treeb8a2e68578c901bb3e02b569eab7d95b250f7d56 /test
parent40ee8cb9234721dbfe66f3fcb5fda8fb5ad64163 (diff)
downloadklee-04646910ca0fc5a4b08d9a6cdc3cd8c8ae5419ee.tar.gz
Added a test for invocations of klee_make_symbolic with a wrong size to MakeSymbolicAPI.c, and reformatted the file.
Diffstat (limited to 'test')
-rw-r--r--test/Feature/MakeSymbolicAPI.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/test/Feature/MakeSymbolicAPI.c b/test/Feature/MakeSymbolicAPI.c
index b10ea9cf..d5305422 100644
--- a/test/Feature/MakeSymbolicAPI.c
+++ b/test/Feature/MakeSymbolicAPI.c
@@ -6,24 +6,26 @@
 
 int main() {
   unsigned a, b, c;
-  char* p;
-  const char *invalid_pointer = 0xf;
+  char *p;
+  const char *invalid_pointer = (char *)0xf;
 
   klee_make_symbolic(&a, sizeof(a), "");
-  //CHECK-WRN: KLEE: WARNING: klee_make_symbolic: renamed empty name to "unnamed"
+  // CHECK-WRN: KLEE: WARNING: klee_make_symbolic: renamed empty name to "unnamed"
 
   klee_make_symbolic(&p, sizeof(p), "p");
 
   if (a == 2)
     klee_make_symbolic(&c, sizeof(c), invalid_pointer);
-    //CHECK-ERR-DAG: KLEE: ERROR: {{.*}} Invalid string pointer passed to one of the klee_ functions
+    // CHECK-ERR-DAG: KLEE: ERROR: {{.*}} Invalid string pointer passed to one of the klee_ functions
 
   if (a == 3)
     klee_make_symbolic(&c, sizeof(c), p);
-    //CHECK-ERR-DAG: KLEE: ERROR: {{.*}} Symbolic string pointer passed to one of the klee_ functions
-
-  klee_make_symbolic(&b, sizeof(b));
-  //CHECK-ERR-DAG: KLEE: ERROR: {{.*}} Incorrect number of arguments to klee_make_symbolic(void*, size_t, char*)
+    // CHECK-ERR-DAG: KLEE: ERROR: {{.*}} Symbolic string pointer passed to one of the klee_ functions
 
+  if (a == 4)
+    klee_make_symbolic(&c, sizeof(c) - 1, "c");
+    // CHECK-ERR-DAG: KLEE: ERROR: {{.*}} Wrong size given to klee_make_symbolic
 
+  klee_make_symbolic(&b, sizeof(b));
+  // CHECK-ERR-DAG: KLEE: ERROR: {{.*}} Incorrect number of arguments to klee_make_symbolic(void*, size_t, char*)
 }