diff options
author | Anton Samokhvalov <pg83@yandex.ru> | 2022-02-10 16:45:15 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:45:15 +0300 |
commit | 72cb13b4aff9bc9cf22e49251bc8fd143f82538f (patch) | |
tree | da2c34829458c7d4e74bdfbdf85dff449e9e7fb8 /library/cpp/comptable/ut/comptable_ut.cpp | |
parent | 778e51ba091dc39e7b7fcab2b9cf4dbedfb6f2b5 (diff) | |
download | ydb-72cb13b4aff9bc9cf22e49251bc8fd143f82538f.tar.gz |
Restoring authorship annotation for Anton Samokhvalov <pg83@yandex.ru>. Commit 1 of 2.
Diffstat (limited to 'library/cpp/comptable/ut/comptable_ut.cpp')
-rw-r--r-- | library/cpp/comptable/ut/comptable_ut.cpp | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/library/cpp/comptable/ut/comptable_ut.cpp b/library/cpp/comptable/ut/comptable_ut.cpp index 5901d0246f..5bb2058fce 100644 --- a/library/cpp/comptable/ut/comptable_ut.cpp +++ b/library/cpp/comptable/ut/comptable_ut.cpp @@ -1,13 +1,13 @@ #include <library/cpp/comptable/comptable.h> #include <library/cpp/testing/unittest/registar.h> -#include <util/random/random.h> -#include <util/random/fast.h> - +#include <util/random/random.h> +#include <util/random/fast.h> + using namespace NCompTable; -template <bool HQ> -void DoTest(const TCompressorTable& table, const TVector<TString>& lines) { +template <bool HQ> +void DoTest(const TCompressorTable& table, const TVector<TString>& lines) { TVector<char> compressed; TVector<char> decompressed; @@ -21,8 +21,8 @@ void DoTest(const TCompressorTable& table, const TVector<TString>& lines) { size_t origSize = 0; size_t compSize = 0; - for (size_t i = 0; i < lines.size(); ++i) { - const TString& line = lines[i]; + for (size_t i = 0; i < lines.size(); ++i) { + const TString& line = lines[i]; compressor.Compress(line, &compressed); origSize += line.size(); compSize += compressed.size(); @@ -30,30 +30,30 @@ void DoTest(const TCompressorTable& table, const TVector<TString>& lines) { deCompressor.Decompress(in, &decompressed); UNIT_ASSERT(decompressed.size() == line.size() && memcmp(decompressed.data(), line.data(), decompressed.size()) == 0); } - UNIT_ASSERT_EQUAL(origSize, 45491584); + UNIT_ASSERT_EQUAL(origSize, 45491584); if (HQ) { - UNIT_ASSERT_EQUAL(compSize, 11074583); + UNIT_ASSERT_EQUAL(compSize, 11074583); } else { - UNIT_ASSERT_EQUAL(compSize, 17459336); + UNIT_ASSERT_EQUAL(compSize, 17459336); } UNIT_ASSERT(compSize < origSize); } Y_UNIT_TEST_SUITE(TestComptable) { Y_UNIT_TEST(TestComptableCompressDecompress) { - TReallyFastRng32 rr(17); + TReallyFastRng32 rr(17); TVector<TString> lines; for (size_t i = 0; i < 1000000; ++i) { - size_t size = rr.Uniform(32); + size_t size = rr.Uniform(32); TString res = "www.yandex.ru/yandsearch?text="; for (size_t j = 0; j < size; ++j) { - res += "qwer"[rr.Uniform(4)]; + res += "qwer"[rr.Uniform(4)]; } lines.push_back(res); } THolder<TDataSampler> sampler(new TDataSampler); for (size_t i = 0; i < lines.size(); ++i) { - sampler->AddStat(lines[i]); + sampler->AddStat(lines[i]); } TCompressorTable table; sampler->BuildTable(table); |