2 * Copyright (c) Meta Platforms, Inc. and affiliates.
5 * This source code is licensed under both the BSD-style license (found in the
6 * LICENSE file in the root directory of this source tree) and the GPLv2 (found
7 * in the COPYING file in the root directory of this source tree).
8 * You may select, at your option, one of the above-listed licenses.
15 #include "decompress_sources.h"
16 #include <linux/zstd.h>
21 fprintf(stderr, "%s:%u: %s failed!\n", __FUNCTION__, __LINE__, #x); \
27 static const char kEmptyZstdFrame[] = {
28 0x28, 0xb5, 0x2f, 0xfd, 0x24, 0x00, 0x01, 0x00, 0x00, 0x99, 0xe9, 0xd8, 0x51
31 static void test_decompress_unzstd(void) {
32 fprintf(stderr, "Testing decompress unzstd... ");
34 size_t const wkspSize = zstd_dctx_workspace_bound();
35 void* wksp = malloc(wkspSize);
36 ZSTD_DCtx* dctx = zstd_init_dctx(wksp, wkspSize);
37 CONTROL(wksp != NULL);
38 CONTROL(dctx != NULL);
40 size_t const dSize = zstd_decompress_dctx(dctx, NULL, 0, kEmptyZstdFrame, sizeof(kEmptyZstdFrame));
41 CONTROL(!zstd_is_error(dSize));
46 fprintf(stderr, "Ok\n");
50 test_decompress_unzstd();