diff options
author | kulikov <kulikov@yandex-team.ru> | 2022-02-10 16:49:34 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:49:34 +0300 |
commit | 65e5266709e7ff94b14ae128309e229de714b0df (patch) | |
tree | d4901f06e56d95f5e5d36bd1806bcc144d03bf41 /util/system/file_ut.cpp | |
parent | 0041d99876ae3dccc3f0fa8787131d85ddfd486b (diff) | |
download | ydb-65e5266709e7ff94b14ae128309e229de714b0df.tar.gz |
Restoring authorship annotation for <kulikov@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'util/system/file_ut.cpp')
-rw-r--r-- | util/system/file_ut.cpp | 52 |
1 files changed, 26 insertions, 26 deletions
diff --git a/util/system/file_ut.cpp b/util/system/file_ut.cpp index 941e6a50f3d..2d5343c94dc 100644 --- a/util/system/file_ut.cpp +++ b/util/system/file_ut.cpp @@ -21,7 +21,7 @@ class TFileTest: public TTestBase { UNIT_TEST(TestFlushSpecialFile); UNIT_TEST(TestRawRead); UNIT_TEST(TestRead); - UNIT_TEST(TestRawPread); + UNIT_TEST(TestRawPread); UNIT_TEST(TestPread); UNIT_TEST(TestCache); UNIT_TEST_SUITE_END(); @@ -35,7 +35,7 @@ public: void TestFlushSpecialFile(); void TestRawRead(); void TestRead(); - void TestRawPread(); + void TestRawPread(); void TestPread(); void TestCache(); @@ -281,30 +281,30 @@ void TFileTest::TestRead() { } } -void TFileTest::TestRawPread() { - TTempFile tmp("tmp"); - - { - TFile file(tmp.Name(), OpenAlways | WrOnly); - file.Write("1234567", 7); - file.Flush(); - file.Close(); - } - - { - TFile file(tmp.Name(), OpenExisting | RdOnly); - char buf[7]; - i32 reallyRead = file.RawPread(buf, 3, 1); - Y_ENSURE(0 <= reallyRead && reallyRead <= 3); - Y_ENSURE(TStringBuf(buf, reallyRead) == TStringBuf("234").Head(reallyRead)); - - memset(buf, 0, sizeof(buf)); - reallyRead = file.RawPread(buf, 2, 5); - Y_ENSURE(0 <= reallyRead && reallyRead <= 2); - Y_ENSURE(TStringBuf(buf, reallyRead) == TStringBuf("67").Head(reallyRead)); - } -} - +void TFileTest::TestRawPread() { + TTempFile tmp("tmp"); + + { + TFile file(tmp.Name(), OpenAlways | WrOnly); + file.Write("1234567", 7); + file.Flush(); + file.Close(); + } + + { + TFile file(tmp.Name(), OpenExisting | RdOnly); + char buf[7]; + i32 reallyRead = file.RawPread(buf, 3, 1); + Y_ENSURE(0 <= reallyRead && reallyRead <= 3); + Y_ENSURE(TStringBuf(buf, reallyRead) == TStringBuf("234").Head(reallyRead)); + + memset(buf, 0, sizeof(buf)); + reallyRead = file.RawPread(buf, 2, 5); + Y_ENSURE(0 <= reallyRead && reallyRead <= 2); + Y_ENSURE(TStringBuf(buf, reallyRead) == TStringBuf("67").Head(reallyRead)); + } +} + void TFileTest::TestPread() { TTempFile tmp("tmp"); |