Skip to content

Commit 64f1c3d

Browse files
author
Thomas Kiley
committed
Add test verifying that the string abstraction is enabled
This checks the body of goto functions whose implementation depends on whether the string abstraction macro is defined.
1 parent 3abc5db commit 64f1c3d

File tree

3 files changed

+29
-0
lines changed

3 files changed

+29
-0
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
CORE
2+
test.c
3+
--string-abstraction --show-goto-functions
4+
strlen#return_value = \(.*\)s#strarg->length - POINTER_OFFSET\(s\);
5+
^EXIT=0$
6+
^SIGNAL=0$
7+
--
8+
--
9+
Ensure that the --string-abstraction flag enables the string abstraction
10+
version of string functions
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
CORE
2+
test.c
3+
--show-goto-functions
4+
IF !\(\(signed int\)s\[\(.*\)len\] != 0\) THEN GOTO 2
5+
^EXIT=0$
6+
^SIGNAL=0$
7+
--
8+
--
9+
Ensure that if the string abstraction flag is not provided, the regular model for
10+
string functions is used (in this case searching for the terminator).
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#include <assert.h>
2+
#include <stdlib.h>
3+
4+
int main()
5+
{
6+
char *x = malloc(sizeof(char) * 10);
7+
x[8] = '\0';
8+
assert(strlen(x) == 8);
9+
}

0 commit comments

Comments
 (0)