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/archive/yarchive_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/archive/yarchive_ut.cpp')
-rw-r--r-- | library/cpp/archive/yarchive_ut.cpp | 88 |
1 files changed, 44 insertions, 44 deletions
diff --git a/library/cpp/archive/yarchive_ut.cpp b/library/cpp/archive/yarchive_ut.cpp index 602a1cdbbd..d4abdcd44c 100644 --- a/library/cpp/archive/yarchive_ut.cpp +++ b/library/cpp/archive/yarchive_ut.cpp @@ -1,67 +1,67 @@ -#include "yarchive.h" - +#include "yarchive.h" + #include <library/cpp/testing/unittest/registar.h> - -#include <util/string/cast.h> + +#include <util/string/cast.h> #include <util/stream/file.h> -#include <util/system/tempfile.h> +#include <util/system/tempfile.h> #include <util/memory/blob.h> - -class TArchiveTest: public TTestBase { - UNIT_TEST_SUITE(TArchiveTest) - UNIT_TEST(TestCreate); - UNIT_TEST(TestRead); + +class TArchiveTest: public TTestBase { + UNIT_TEST_SUITE(TArchiveTest) + UNIT_TEST(TestCreate); + UNIT_TEST(TestRead); UNIT_TEST(TestOffsetOrder); - UNIT_TEST_SUITE_END(); - -private: + UNIT_TEST_SUITE_END(); + +private: void CreateArchive(); - void TestCreate(); - void TestRead(); + void TestCreate(); + void TestRead(); void TestOffsetOrder(); -}; - -UNIT_TEST_SUITE_REGISTRATION(TArchiveTest); - -#define ARCHIVE "./test.ar" - +}; + +UNIT_TEST_SUITE_REGISTRATION(TArchiveTest); + +#define ARCHIVE "./test.ar" + void TArchiveTest::CreateArchive() { TFixedBufferFileOutput out(ARCHIVE); - TArchiveWriter w(&out); - - for (size_t i = 0; i < 1000; ++i) { + TArchiveWriter w(&out); + + for (size_t i = 0; i < 1000; ++i) { const TString path = "/" + ToString(i); const TString data = "data" + ToString(i * 1000) + "dataend"; - TStringInput si(data); - - w.Add(path, &si); - } - - w.Finish(); - out.Finish(); -} - + TStringInput si(data); + + w.Add(path, &si); + } + + w.Finish(); + out.Finish(); +} + void TArchiveTest::TestCreate() { CreateArchive(); TTempFile tmpFile(ARCHIVE); } -void TArchiveTest::TestRead() { +void TArchiveTest::TestRead() { CreateArchive(); - TTempFile tmpFile(ARCHIVE); + TTempFile tmpFile(ARCHIVE); TBlob blob = TBlob::FromFileSingleThreaded(ARCHIVE); - TArchiveReader r(blob); - - UNIT_ASSERT_EQUAL(r.Count(), 1000); - - for (size_t i = 0; i < 1000; ++i) { + TArchiveReader r(blob); + + UNIT_ASSERT_EQUAL(r.Count(), 1000); + + for (size_t i = 0; i < 1000; ++i) { const TString key = "/" + ToString(i); TAutoPtr<IInputStream> is = r.ObjectByKey(key); const TString data = is->ReadAll(); - - UNIT_ASSERT_EQUAL(data, "data" + ToString(i * 1000) + "dataend"); - } -} + + UNIT_ASSERT_EQUAL(data, "data" + ToString(i * 1000) + "dataend"); + } +} void TArchiveTest::TestOffsetOrder() { CreateArchive(); |