diff options
author | gotmanov <gotmanov@yandex-team.ru> | 2022-02-10 16:49:26 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:49:26 +0300 |
commit | 243edeedfd2c5152b5c7812e0af471e1bb0232e8 (patch) | |
tree | 7efbef4b4e045bcee8833f7fc22a639fa0ff06aa /library/cpp/codecs | |
parent | 56c39b3cf908e7202b1f7551a1653681e8015607 (diff) | |
download | ydb-243edeedfd2c5152b5c7812e0af471e1bb0232e8.tar.gz |
Restoring authorship annotation for <gotmanov@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'library/cpp/codecs')
-rw-r--r-- | library/cpp/codecs/float_huffman.h | 2 | ||||
-rw-r--r-- | library/cpp/codecs/ut/float_huffman_ut.cpp | 38 |
2 files changed, 20 insertions, 20 deletions
diff --git a/library/cpp/codecs/float_huffman.h b/library/cpp/codecs/float_huffman.h index 786a8eae1d..e94a778115 100644 --- a/library/cpp/codecs/float_huffman.h +++ b/library/cpp/codecs/float_huffman.h @@ -47,4 +47,4 @@ namespace NCodecs::NFloatHuff { }; TVector<float> Decode(TStringBuf data, size_t sizeHint = 0); -} +} diff --git a/library/cpp/codecs/ut/float_huffman_ut.cpp b/library/cpp/codecs/ut/float_huffman_ut.cpp index 3156fb1f46..55e578ca03 100644 --- a/library/cpp/codecs/ut/float_huffman_ut.cpp +++ b/library/cpp/codecs/ut/float_huffman_ut.cpp @@ -136,11 +136,11 @@ Y_UNIT_TEST_SUITE(FloatHuffmanTest) { static const size_t CodedSize = Y_ARRAY_SIZE(CodedFactors); static const TStringBuf CodedFactorsBuf(reinterpret_cast<const char*>(CodedFactors), CodedSize); - void FillWithGarbage(float* factors, size_t count) { - void* data = static_cast<void*>(factors); - memset(data, 0xAA, sizeof(float) * count); - } - + void FillWithGarbage(float* factors, size_t count) { + void* data = static_cast<void*>(factors); + memset(data, 0xAA, sizeof(float) * count); + } + // Helper for dumping compressed values void PrintCompressed(const TVector<ui8>& codedFactors) { for (size_t i = 0; i < codedFactors.size(); ++i) { @@ -184,7 +184,7 @@ Y_UNIT_TEST_SUITE(FloatHuffmanTest) { Y_UNIT_TEST(TestDecompressInParts) { float factors[FactorCount]; - FillWithGarbage(factors, FactorCount); + FillWithGarbage(factors, FactorCount); fh::TDecoder decoder(CodedFactorsBuf); const size_t firstPack = 100; // unpack first pack @@ -198,26 +198,26 @@ Y_UNIT_TEST_SUITE(FloatHuffmanTest) { } Y_UNIT_TEST(TestSkip) { - float factors[FactorCount]; - FillWithGarbage(factors, FactorCount); + float factors[FactorCount]; + FillWithGarbage(factors, FactorCount); fh::TDecoder decoder(CodedFactorsBuf); - const size_t firstPack = 100; - // unpack first pack + const size_t firstPack = 100; + // unpack first pack UNIT_ASSERT_VALUES_EQUAL(decoder.Decode({factors, firstPack}), firstPack); - // skip some factors - const size_t skipCount = 60; + // skip some factors + const size_t skipCount = 60; UNIT_ASSERT_VALUES_EQUAL(decoder.Skip(skipCount / 2), skipCount / 2); - // unpack all, except some factors in the end + // unpack all, except some factors in the end const auto toDecode = FactorCount - firstPack - skipCount; UNIT_ASSERT_VALUES_EQUAL(decoder.Decode({factors + firstPack, toDecode}), toDecode); UNIT_ASSERT_VALUES_EQUAL(decoder.Skip(skipCount / 2), skipCount / 2); for (size_t i = 0; i < FactorCount - skipCount; ++i) { - size_t correctedI = i < firstPack ? i : i + skipCount / 2; - UNIT_ASSERT_VALUES_EQUAL(factors[i], Factors[correctedI]); - } - //PrintDecompressed(factors); - } - + size_t correctedI = i < firstPack ? i : i + skipCount / 2; + UNIT_ASSERT_VALUES_EQUAL(factors[i], Factors[correctedI]); + } + //PrintDecompressed(factors); + } + Y_UNIT_TEST(TestDecompressForgedData) { // this coredumps without end-of-coded-stream check, see SEARCH-1156 for details TString brokenBase64Encoded = |