MCPcopy Create free account
hub / github.com/Snapchat/Valdi / compressData

Function compressData

valdi/test/runtime/ZStdUtils_tests.cpp:28–35  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

26namespace ValdiTest {
27
28static std::vector<Byte> compressData(const Byte* src, size_t srcSize) {
29 auto bound = ZSTD_compressBound(srcSize);
30 std::vector<Byte> compressed(bound);
31 auto compressedSize = ZSTD_compress(compressed.data(), compressed.size(), src, srcSize, 1);
32 EXPECT_FALSE(ZSTD_isError(compressedSize));
33 compressed.resize(compressedSize);
34 return compressed;
35}
36
37TEST(ZStdUtils, isZstdFileReturnsFalseForShortInput) {
38 std::array<Byte, 3> data = {0x28, 0xB5, 0x2F};

Callers 1

TESTFunction · 0.85

Calls 6

ZSTD_compressBoundFunction · 0.85
ZSTD_compressFunction · 0.85
ZSTD_isErrorFunction · 0.85
dataMethod · 0.45
sizeMethod · 0.45
resizeMethod · 0.45

Tested by

no test coverage detected