From 91ffc8d256b4a21f29b82057868ccb1fcf9ebb12 Mon Sep 17 00:00:00 2001 From: shakeelrao Date: Fri, 15 Mar 2019 03:59:03 -0700 Subject: [PATCH] Add test to validate patch --- tests/legacy.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) 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;