Skip to content

Commit 5dafcef

Browse files
committed
Improve test.
1 parent 2bcc553 commit 5dafcef

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

test/malloc.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,18 @@ point_ptr mk_point()
2626
// TODO: > INT32_MIN
2727
#define INT32_FITS(x) ((x) >= 0 && (x) < INT32_MAX)
2828

29+
int sum_point(const point_ptr p)
30+
_requires(INT32_FITS((_specint) p->x + p->y))
31+
_ensures(return == _old(p->x + p->y))
32+
{
33+
return p->x + p->y;
34+
}
35+
2936
int sum_and_free_point(_consumes point_ptr p)
3037
_requires(INT32_FITS((_specint) p->x + p->y))
3138
_ensures(return == _old(p->x + p->y))
3239
{
33-
int sum = p->x + p->y;
40+
int sum = sum_point(p);
3441
free(p);
3542
return sum;
3643
}

0 commit comments

Comments
 (0)