From 51990246c3d5d8caa4d182e2298e12fc5761bf3d Mon Sep 17 00:00:00 2001 From: Nick Terrell Date: Wed, 18 Sep 2019 11:05:08 -0700 Subject: [PATCH] [test] Test the bounds of ZSTD_c_srcSizeHint --- tests/zstreamtest.c | 10 ++++++++++ 1 file changed, 10 insertions(+) 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: -- 2.47.2