From: shakeelrao Date: Fri, 15 Mar 2019 10:59:03 +0000 (-0700) Subject: Add test to validate patch X-Git-Tag: v1.4.0^2~27^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=91ffc8d256b4a21f29b82057868ccb1fcf9ebb12;p=thirdparty%2Fzstd.git Add test to validate patch --- diff --git a/tests/legacy.c b/tests/legacy.c index b749567f4..6da71227f 100644 --- a/tests/legacy.c +++ b/tests/legacy.c @@ -130,12 +130,28 @@ static int testStreamingAPI(void) return error_code; } +static int testFrameDecoding(void) +{ + if (ZSTD_decompressBound(COMPRESSED, COMPRESSED_SIZE) != ZSTD_CONTENTSIZE_ERROR) { + DISPLAY("ERROR: ZSTD_decompressBound: Expected to receive ZSTD_CONTENTSIZE_ERROR\n"); + return 1; + } + if (ZSTD_findFrameCompressedSize(COMPRESSED) != COMPRESSED_SIZE) { + DISPLAY("ERROR: ZSTD_findFrameCompressedSize: Expected to receive %d\n", COMPRESSED_SIZE); + return 1; + } + DISPLAY("Frame Decoding OK\n"); + return 0; +} + int main(void) { { int const ret = testSimpleAPI(); if (ret) return ret; } { int const ret = testStreamingAPI(); if (ret) return ret; } + { int const ret = testFrameDecoding(); + if (ret) return ret; } DISPLAY("OK\n"); return 0;