diff options
author | nikitamorozov <nikitamorozov@yandex-team.ru> | 2022-02-10 16:49:20 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:49:20 +0300 |
commit | 523d26598d9784601932189f7fceb34d61bf7641 (patch) | |
tree | 5d5cb817648f650d76cf1076100726fd9b8448e8 /util/stream/str_ut.cpp | |
parent | 2342f2b56e674c21307fcb92a37853f950224d31 (diff) | |
download | ydb-523d26598d9784601932189f7fceb34d61bf7641.tar.gz |
Restoring authorship annotation for <nikitamorozov@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'util/stream/str_ut.cpp')
-rw-r--r-- | util/stream/str_ut.cpp | 52 |
1 files changed, 26 insertions, 26 deletions
diff --git a/util/stream/str_ut.cpp b/util/stream/str_ut.cpp index 264db21dcf..fc6b46c31a 100644 --- a/util/stream/str_ut.cpp +++ b/util/stream/str_ut.cpp @@ -6,7 +6,7 @@ template <typename T> const T ReturnConstTemp(); -Y_UNIT_TEST_SUITE(TStringInputOutputTest) { +Y_UNIT_TEST_SUITE(TStringInputOutputTest) { Y_UNIT_TEST(Lvalue) { TString str = "Hello, World!"; TStringInput input(str); @@ -88,31 +88,31 @@ Y_UNIT_TEST_SUITE(TStringInputOutputTest) { UNIT_ASSERT_VALUES_EQUAL(t, "89abc"); } - Y_UNIT_TEST(WriteViaNextAndUndo) { - TString str1; - TStringOutput output(str1); - TString str2; - - for (size_t i = 0; i < 10000; ++i) { - str2.push_back('a' + (i % 20)); - } - - size_t written = 0; - void* ptr = nullptr; - while (written < str2.size()) { - size_t bufferSize = output.Next(&ptr); - UNIT_ASSERT(ptr && bufferSize > 0); - size_t toWrite = Min(bufferSize, str2.size() - written); - memcpy(ptr, str2.begin() + written, toWrite); - written += toWrite; - if (toWrite < bufferSize) { - output.Undo(bufferSize - toWrite); - } - } - - UNIT_ASSERT_STRINGS_EQUAL(str1, str2); - } - + Y_UNIT_TEST(WriteViaNextAndUndo) { + TString str1; + TStringOutput output(str1); + TString str2; + + for (size_t i = 0; i < 10000; ++i) { + str2.push_back('a' + (i % 20)); + } + + size_t written = 0; + void* ptr = nullptr; + while (written < str2.size()) { + size_t bufferSize = output.Next(&ptr); + UNIT_ASSERT(ptr && bufferSize > 0); + size_t toWrite = Min(bufferSize, str2.size() - written); + memcpy(ptr, str2.begin() + written, toWrite); + written += toWrite; + if (toWrite < bufferSize) { + output.Undo(bufferSize - toWrite); + } + } + + UNIT_ASSERT_STRINGS_EQUAL(str1, str2); + } + Y_UNIT_TEST(Write) { TString str; TStringOutput output(str); |