From 0ebd221a2727fce6b7506ff6f6764f5bef14a3e4 Mon Sep 17 00:00:00 2001 From: Project Nayuki Date: Mon, 22 Jul 2019 17:56:28 +0000 Subject: [PATCH] Updated C test suite for an internal function because the parameter is size_t and not int. (The function and test were introduced in commit 08108ee6d8ae.) --- c/qrcodegen-test.c | 42 +++++++++++++++++++----------------------- 1 file changed, 19 insertions(+), 23 deletions(-) diff --git a/c/qrcodegen-test.c b/c/qrcodegen-test.c index 4648dcf..37612d7 100644 --- a/c/qrcodegen-test.c +++ b/c/qrcodegen-test.c @@ -717,9 +717,10 @@ static void testCalcSegmentBitLength(void) { {9832, -1}, {12000, -1}, {28453, -1}, - {INT_MAX / 3, -1}, - {INT_MAX / 2, -1}, - {INT_MAX / 1, -1}, + {SIZE_MAX / 6, -1}, + {SIZE_MAX / 3, -1}, + {SIZE_MAX / 2, -1}, + {SIZE_MAX / 1, -1}, }; for (size_t i = 0; i < ARRAY_LENGTH(CASES); i++) { assert(calcSegmentBitLength(qrcodegen_Mode_NUMERIC, CASES[i].numChars) == CASES[i].result); @@ -745,11 +746,10 @@ static void testCalcSegmentBitLength(void) { {5959, -1}, {12000, -1}, {28453, -1}, - {INT_MAX / 5, -1}, - {INT_MAX / 4, -1}, - {INT_MAX / 3, -1}, - {INT_MAX / 2, -1}, - {INT_MAX / 1, -1}, + {SIZE_MAX / 10, -1}, + {SIZE_MAX / 5, -1}, + {SIZE_MAX / 2, -1}, + {SIZE_MAX / 1, -1}, }; for (size_t i = 0; i < ARRAY_LENGTH(CASES); i++) { assert(calcSegmentBitLength(qrcodegen_Mode_ALPHANUMERIC, CASES[i].numChars) == CASES[i].result); @@ -771,14 +771,11 @@ static void testCalcSegmentBitLength(void) { {5957, -1}, {12000, -1}, {28453, -1}, - {INT_MAX / 8 + 1, -1}, - {INT_MAX / 7, -1}, - {INT_MAX / 6, -1}, - {INT_MAX / 5, -1}, - {INT_MAX / 4, -1}, - {INT_MAX / 3, -1}, - {INT_MAX / 2, -1}, - {INT_MAX / 1, -1}, + {SIZE_MAX / 15, -1}, + {SIZE_MAX / 12, -1}, + {SIZE_MAX / 7, -1}, + {SIZE_MAX / 3, -1}, + {SIZE_MAX / 1, -1}, }; for (size_t i = 0; i < ARRAY_LENGTH(CASES); i++) { assert(calcSegmentBitLength(qrcodegen_Mode_BYTE, CASES[i].numChars) == CASES[i].result); @@ -800,13 +797,12 @@ static void testCalcSegmentBitLength(void) { {2522, -1}, {12000, -1}, {28453, -1}, - {INT_MAX / 13 + 1, -1}, - {INT_MAX / 12, -1}, - {INT_MAX / 9, -1}, - {INT_MAX / 4, -1}, - {INT_MAX / 3, -1}, - {INT_MAX / 2, -1}, - {INT_MAX / 1, -1}, + {SIZE_MAX / 25, -1}, + {SIZE_MAX / 20, -1}, + {SIZE_MAX / 11, -1}, + {SIZE_MAX / 4, -1}, + {SIZE_MAX / 2, -1}, + {SIZE_MAX / 1, -1}, }; for (size_t i = 0; i < ARRAY_LENGTH(CASES); i++) { assert(calcSegmentBitLength(qrcodegen_Mode_KANJI, CASES[i].numChars) == CASES[i].result);