From: Nick Terrell Date: Wed, 18 Sep 2019 18:05:08 +0000 (-0700) Subject: [test] Test the bounds of ZSTD_c_srcSizeHint X-Git-Tag: v1.4.4~1^2~44^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F1801%2Fhead;p=thirdparty%2Fzstd.git [test] Test the bounds of ZSTD_c_srcSizeHint --- diff --git a/tests/zstreamtest.c b/tests/zstreamtest.c index 9af08ebe4..2047d4bd8 100644 --- a/tests/zstreamtest.c +++ b/tests/zstreamtest.c @@ -1151,6 +1151,16 @@ static int basicUnitTests(U32 seed, double compressibility) } DISPLAYLEVEL(3, "OK \n"); + DISPLAYLEVEL(3, "test%3i : ZSTD_c_srcSizeHint bounds : ", testNb++); + ZSTD_CCtx_reset(zc, ZSTD_reset_session_and_parameters); + CHECK_Z(ZSTD_CCtx_setParameter(zc, ZSTD_c_srcSizeHint, INT_MAX)); + { int srcSizeHint; + CHECK_Z(ZSTD_CCtx_getParameter(zc, ZSTD_c_srcSizeHint, &srcSizeHint)); + CHECK(!(srcSizeHint == INT_MAX), "srcSizeHint doesn't match"); + } + CHECK(!ZSTD_isError(ZSTD_CCtx_setParameter(zc, ZSTD_c_srcSizeHint, -1)), "Out of range doesn't error"); + DISPLAYLEVEL(3, "OK \n"); + /* Overlen overwriting window data bug */ DISPLAYLEVEL(3, "test%3i : wildcopy doesn't overwrite potential match data : ", testNb++); { /* This test has a window size of 1024 bytes and consists of 3 blocks: