]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
Add test to validate patch
authorshakeelrao <shakeelrao79@gmail.com>
Fri, 15 Mar 2019 10:59:03 +0000 (03:59 -0700)
committershakeelrao <shakeelrao79@gmail.com>
Fri, 15 Mar 2019 10:59:03 +0000 (03:59 -0700)
tests/legacy.c

index b749567f440baf8902c0addd0720ed7da7d0d9d7..6da71227ffd7142cc6b4d562bcd2e19909490f18 100644 (file)
@@ -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;