Skip to content

Commit ad5ba04

Browse files
committed
Change klee and add tests
1 parent fbf6554 commit ad5ba04

File tree

3 files changed

+40
-1
lines changed

3 files changed

+40
-1
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#include "hard-linked-list.h"
2+
#include <stddef.h>
3+
4+
int hard_list_and_pointers(struct Node *node) {
5+
if (node == NULL) {
6+
return 0;
7+
}
8+
if (node->x == NULL || node->data == NULL) {
9+
return -1;
10+
}
11+
if (node->x == &(node->data->x) && *node->x == node->data->x) {
12+
return 1;
13+
}
14+
if (node->next == NULL) {
15+
return -2;
16+
}
17+
if (node->next->x == NULL || node->next->data == NULL) {
18+
return -3;
19+
}
20+
if (node->next->data == node->data && &(node->next->data->y) == node->x && node->next->data->y == *node->x) {
21+
return 2;
22+
}
23+
return 3;
24+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#ifndef HARD_LINKED_LIST_H
2+
#define HARD_LINKED_LIST_H
3+
4+
struct Data {
5+
int x;
6+
int y;
7+
};
8+
9+
struct Node {
10+
int *x;
11+
struct Data *data;
12+
struct Node *next;
13+
};
14+
15+
#endif

0 commit comments

Comments
 (0)