From e273661227b4684265c09e04f75db81f7c5e697e Mon Sep 17 00:00:00 2001 From: Ivan Maidanski Date: Thu, 29 Sep 2016 00:32:47 +0300 Subject: [PATCH] Add more cases to huge_test to cover sizes close to word-type maximum * tests/huge_test.c (GC_WORD_MAX): New macro. * tests/huge_test.c (GC_SWORD_MAX): Use GC_WORD_MAX. * tests/huge_test.c (main): Add GC_SWORD_MAX+1, GC_WORD_MAX, GC_WORD_MAX-4/8/16/1024 test cases. --- tests/huge_test.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/tests/huge_test.c b/tests/huge_test.c index 9c29af3..10d13ef 100644 --- a/tests/huge_test.c +++ b/tests/huge_test.c @@ -36,7 +36,8 @@ } \ } while (0) -#define GC_SWORD_MAX ((GC_signed_word)(((GC_word)-1) >> 1)) +#define GC_WORD_MAX ((GC_word)-1) +#define GC_SWORD_MAX ((GC_signed_word)(GC_WORD_MAX >> 1)) int main(void) { @@ -44,7 +45,13 @@ int main(void) CHECK_ALLOC_FAILED(GC_MALLOC(GC_SWORD_MAX - 1024), "SWORD_MAX-1024"); CHECK_ALLOC_FAILED(GC_MALLOC(GC_SWORD_MAX), "SWORD_MAX"); + CHECK_ALLOC_FAILED(GC_MALLOC((GC_word)GC_SWORD_MAX + 1), "SWORD_MAX+1"); CHECK_ALLOC_FAILED(GC_MALLOC((GC_word)GC_SWORD_MAX + 1024), "SWORD_MAX+1024"); + CHECK_ALLOC_FAILED(GC_MALLOC(GC_WORD_MAX - 1024), "WORD_MAX-1024"); + CHECK_ALLOC_FAILED(GC_MALLOC(GC_WORD_MAX - 16), "WORD_MAX-16"); + CHECK_ALLOC_FAILED(GC_MALLOC(GC_WORD_MAX - 8), "WORD_MAX-8"); + CHECK_ALLOC_FAILED(GC_MALLOC(GC_WORD_MAX - 4), "WORD_MAX-4"); + CHECK_ALLOC_FAILED(GC_MALLOC(GC_WORD_MAX), "WORD_MAX"); return 0; } -- 2.7.4