Skip to content

Commit

Permalink
Merge pull request #139 from bjjwwang/master
Browse files Browse the repository at this point in the history
add NULL cases
  • Loading branch information
yuleisui authored May 23, 2024
2 parents 21e6002 + cf62d88 commit a07cd56
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/ae_assert_tests/NULL_1.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#include "stdbool.h"
#include <stdlib.h>
extern void svf_assert(bool);

int main() {
int *ptr = NULL;
svf_assert(ptr == NULL);
return 0;
}
10 changes: 10 additions & 0 deletions src/ae_assert_tests/NULL_2.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#include "stdbool.h"
#include <stdlib.h>
extern void svf_assert(bool);

int main() {
int value = 10;
int *ptr = &value;
svf_assert(ptr != NULL);
return 0;
}
15 changes: 15 additions & 0 deletions src/ae_assert_tests/NULL_3.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#include "stdbool.h"
#include <stdlib.h>
extern void svf_assert(bool);

int main() {
int *ptr = NULL;
bool isNullDereference = false;

if (ptr == NULL) {
isNullDereference = true;
}

svf_assert(isNullDereference);
return 0;
}
12 changes: 12 additions & 0 deletions src/ae_assert_tests/NULL_4.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#include "stdbool.h"
#include <stdlib.h>
extern void svf_assert(bool);

int main() {
int *a[3][3] = {NULL};

bool isNull = (a[0][0] == NULL);
svf_assert(isNull);

return 0;
}

0 comments on commit a07cd56

Please sign in to comment.