-
-
Save m-alvarez/c082ffc28c523fc0a9d2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdlib.h> | |
#include "klee/klee.h" | |
struct Node { | |
int value; | |
struct Node *next; | |
}; | |
struct Node *symbolic() { | |
int isNull = klee_range(0, 2, "isNull"); | |
if (isNull) { | |
return NULL; | |
} else { | |
struct Node *next = symbolic(); | |
int value = klee_int("value"); | |
struct Node *this = malloc(sizeof(struct Node)); | |
this->value = value; | |
this->next = next; | |
return this; | |
} | |
} | |
int head(struct Node *list) { | |
klee_assert(list != NULL); | |
return list->value; | |
} | |
int main() { | |
struct Node *l = symbolic(); | |
klee_assert(l != NULL); | |
klee_assert(head(l) == l->value); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment