diff options
author | Ruslan Kovalev <ruslan.a.kovalev@gmail.com> | 2022-02-10 16:46:44 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:46:44 +0300 |
commit | 59e19371de37995fcb36beb16cd6ec030af960bc (patch) | |
tree | fa68e36093ebff8b805462e9e6d331fe9d348214 /library/cpp/codecs/static/ut | |
parent | 89db6fe2fe2c32d2a832ddfeb04e8d078e301084 (diff) | |
download | ydb-59e19371de37995fcb36beb16cd6ec030af960bc.tar.gz |
Restoring authorship annotation for Ruslan Kovalev <ruslan.a.kovalev@gmail.com>. Commit 1 of 2.
Diffstat (limited to 'library/cpp/codecs/static/ut')
-rw-r--r-- | library/cpp/codecs/static/ut/builder_ut.cpp | 94 | ||||
-rw-r--r-- | library/cpp/codecs/static/ut/static_ut.cpp | 38 | ||||
-rw-r--r-- | library/cpp/codecs/static/ut/ya.make | 24 |
3 files changed, 78 insertions, 78 deletions
diff --git a/library/cpp/codecs/static/ut/builder_ut.cpp b/library/cpp/codecs/static/ut/builder_ut.cpp index b47c279ed1..48d5c98d5d 100644 --- a/library/cpp/codecs/static/ut/builder_ut.cpp +++ b/library/cpp/codecs/static/ut/builder_ut.cpp @@ -1,57 +1,57 @@ #include <library/cpp/testing/unittest/registar.h> #include <library/cpp/codecs/static/builder.h> #include <library/cpp/codecs/static/static_codec_info.pb.h> -#include <util/string/vector.h> - +#include <util/string/vector.h> + class TStaticCodecInfoBuilderTest: public NUnitTest::TTestBase { - UNIT_TEST_SUITE(TStaticCodecInfoBuilderTest) + UNIT_TEST_SUITE(TStaticCodecInfoBuilderTest) UNIT_TEST(TestBuild) - UNIT_TEST_SUITE_END(); + UNIT_TEST_SUITE_END(); -private: +private: TVector<TString> PrepareData() { TVector<TString> data; - for (ui32 i = 'a'; i <= 'z'; ++i) { + for (ui32 i = 'a'; i <= 'z'; ++i) { data.push_back(TString(1, (char)i)); - } - return data; - } - - void TestBuild() { + } + return data; + } + + void TestBuild() { TVector<TString> data; - NCodecs::TCodecBuildInfo info; - info.CodecName = "huffman"; - info.SampleSizeMultiplier = 2; - info.Timestamp = 1467494385; - info.RevisionInfo = "r2385905"; - info.TrainingSetComment = "some dummy data"; - info.TrainingSetResId = "sbr://1234"; - auto res = NCodecs::BuildStaticCodec(PrepareData(), info); - UNIT_ASSERT_VALUES_EQUAL(res.ShortUtf8DebugString(), - "StoredCodec: \"\\007\\000huffman@S\\000a" - "\\006b\\005c\\005d\\005e\\005f\\005g\\005h\\005i\\005j\\005k\\005l\\005m\\005n\\005o" - "\\005p\\005q\\005r\\005s\\005t\\005u\\004v\\004w\\004x\\004y\\004z\\004\xC7?\xC8>" - "\xC9=\xCA<\xCB;\xCC:\3159\3168\3177\3206\3215\3224\3233\3242\3251\3260\xD7/\xD8." - "\xD9-\xDA,\xDB+\xDC*\xDD)\xDE(\xDF\\'\xE0&\xE1%\xE2$\xE3#\xE4\\\"\xE5!\xE6 \xE7" - "\\037\xE8\\036\xE9\\035\xEA\\034\xEB\\033\xEC\\032\xED\\031\xEE\\030\xEF\\027\xF0" - "\\026\xF1\\025\xF2\\024\xF3\\023\xF4\\022\xF5\\021\xF6\\020\xF7\\017\xF8\\016\xF9" - "\\r\xFA\\014\xFB\\013\xFC\\n\xFD\\t\xFE\\010\xFF\\007\" " - "DebugInfo { " - "CodecName: \"huffman\" " - "Timestamp: 1467494385 " - "RevisionInfo: \"r2385905\" " - "SampleSizeMultiplier: 2 " - "TrainingSetComment: \"some dummy data\" " - "TrainingSetResId: \"sbr://1234\" " - "StoredCodecHash: 2509195835471488613 " - "}"); - - UNIT_ASSERT_VALUES_EQUAL(NCodecs::GetStandardFileName(res), "huffman.1467494385.codec_info"); - UNIT_ASSERT_VALUES_EQUAL(res.GetDebugInfo().GetStoredCodecHash(), 2509195835471488613ULL); - - auto res1 = NCodecs::LoadCodecInfoFromString(NCodecs::SaveCodecInfoToString(res)); - UNIT_ASSERT_VALUES_EQUAL(res1.ShortUtf8DebugString(), res.ShortUtf8DebugString()); - } -}; - -UNIT_TEST_SUITE_REGISTRATION(TStaticCodecInfoBuilderTest); + NCodecs::TCodecBuildInfo info; + info.CodecName = "huffman"; + info.SampleSizeMultiplier = 2; + info.Timestamp = 1467494385; + info.RevisionInfo = "r2385905"; + info.TrainingSetComment = "some dummy data"; + info.TrainingSetResId = "sbr://1234"; + auto res = NCodecs::BuildStaticCodec(PrepareData(), info); + UNIT_ASSERT_VALUES_EQUAL(res.ShortUtf8DebugString(), + "StoredCodec: \"\\007\\000huffman@S\\000a" + "\\006b\\005c\\005d\\005e\\005f\\005g\\005h\\005i\\005j\\005k\\005l\\005m\\005n\\005o" + "\\005p\\005q\\005r\\005s\\005t\\005u\\004v\\004w\\004x\\004y\\004z\\004\xC7?\xC8>" + "\xC9=\xCA<\xCB;\xCC:\3159\3168\3177\3206\3215\3224\3233\3242\3251\3260\xD7/\xD8." + "\xD9-\xDA,\xDB+\xDC*\xDD)\xDE(\xDF\\'\xE0&\xE1%\xE2$\xE3#\xE4\\\"\xE5!\xE6 \xE7" + "\\037\xE8\\036\xE9\\035\xEA\\034\xEB\\033\xEC\\032\xED\\031\xEE\\030\xEF\\027\xF0" + "\\026\xF1\\025\xF2\\024\xF3\\023\xF4\\022\xF5\\021\xF6\\020\xF7\\017\xF8\\016\xF9" + "\\r\xFA\\014\xFB\\013\xFC\\n\xFD\\t\xFE\\010\xFF\\007\" " + "DebugInfo { " + "CodecName: \"huffman\" " + "Timestamp: 1467494385 " + "RevisionInfo: \"r2385905\" " + "SampleSizeMultiplier: 2 " + "TrainingSetComment: \"some dummy data\" " + "TrainingSetResId: \"sbr://1234\" " + "StoredCodecHash: 2509195835471488613 " + "}"); + + UNIT_ASSERT_VALUES_EQUAL(NCodecs::GetStandardFileName(res), "huffman.1467494385.codec_info"); + UNIT_ASSERT_VALUES_EQUAL(res.GetDebugInfo().GetStoredCodecHash(), 2509195835471488613ULL); + + auto res1 = NCodecs::LoadCodecInfoFromString(NCodecs::SaveCodecInfoToString(res)); + UNIT_ASSERT_VALUES_EQUAL(res1.ShortUtf8DebugString(), res.ShortUtf8DebugString()); + } +}; + +UNIT_TEST_SUITE_REGISTRATION(TStaticCodecInfoBuilderTest); diff --git a/library/cpp/codecs/static/ut/static_ut.cpp b/library/cpp/codecs/static/ut/static_ut.cpp index 57e1e62887..fda9ffcccb 100644 --- a/library/cpp/codecs/static/ut/static_ut.cpp +++ b/library/cpp/codecs/static/ut/static_ut.cpp @@ -1,27 +1,27 @@ #include <library/cpp/testing/unittest/registar.h> #include <library/cpp/codecs/static/example/example.h> - + class TStaticCodecUsageTest: public NUnitTest::TTestBase { - UNIT_TEST_SUITE(TStaticCodecUsageTest) + UNIT_TEST_SUITE(TStaticCodecUsageTest) UNIT_TEST(TestUsage) - UNIT_TEST_SUITE_END(); + UNIT_TEST_SUITE_END(); -private: - void DoTestUsage(NStaticCodecExample::EDictVersion dv, size_t expectedSize) { +private: + void DoTestUsage(NStaticCodecExample::EDictVersion dv, size_t expectedSize) { const TStringBuf letov = "Всё идёт по плану"; - - TBuffer outEnc, outDec; - NStaticCodecExample::Encode(outEnc, letov, dv); + + TBuffer outEnc, outDec; + NStaticCodecExample::Encode(outEnc, letov, dv); NStaticCodecExample::Decode(outDec, TStringBuf{outEnc.data(), outEnc.size()}); - - UNIT_ASSERT_VALUES_EQUAL(outEnc.Size(), expectedSize); + + UNIT_ASSERT_VALUES_EQUAL(outEnc.Size(), expectedSize); UNIT_ASSERT_EQUAL(TStringBuf(outDec.data(), outDec.size()), letov); - } - - void TestUsage() { - DoTestUsage(NStaticCodecExample::DV_HUFF_20160707, 18u); - DoTestUsage(NStaticCodecExample::DV_SA_HUFF_20160707, 22u); - } -}; - -UNIT_TEST_SUITE_REGISTRATION(TStaticCodecUsageTest) + } + + void TestUsage() { + DoTestUsage(NStaticCodecExample::DV_HUFF_20160707, 18u); + DoTestUsage(NStaticCodecExample::DV_SA_HUFF_20160707, 22u); + } +}; + +UNIT_TEST_SUITE_REGISTRATION(TStaticCodecUsageTest) diff --git a/library/cpp/codecs/static/ut/ya.make b/library/cpp/codecs/static/ut/ya.make index b9116097d8..5bb2017fac 100644 --- a/library/cpp/codecs/static/ut/ya.make +++ b/library/cpp/codecs/static/ut/ya.make @@ -1,14 +1,14 @@ UNITTEST_FOR(library/cpp/codecs/static) - -OWNER(velavokr) - -SRCS( - builder_ut.cpp - static_ut.cpp -) - -PEERDIR( + +OWNER(velavokr) + +SRCS( + builder_ut.cpp + static_ut.cpp +) + +PEERDIR( library/cpp/codecs/static/example -) - -END() +) + +END() |