From: Ivan Maidanski Date: Wed, 28 Sep 2016 21:32:47 +0000 (+0300) Subject: Add more cases to huge_test to cover sizes close to word-type maximum X-Git-Tag: v8.0.0~1132 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e273661227b4684265c09e04f75db81f7c5e697e;p=gc 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. --- diff --git a/tests/huge_test.c b/tests/huge_test.c index 9c29af35..10d13ef2 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; }