diff options
author | Stanislav Kirillov <staskirillov@gmail.com> | 2022-02-10 16:46:08 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:46:08 +0300 |
commit | cb68f224c46a8ee52ac3fdd2a32534b8bb8dc134 (patch) | |
tree | 1a2c5ffcf89eb53ecd79dbc9bc0a195c27404d0c /util/stream/multi_ut.cpp | |
parent | 92fe2b1e7bc79f7b95adef61714fc003f6ea4a1c (diff) | |
download | ydb-cb68f224c46a8ee52ac3fdd2a32534b8bb8dc134.tar.gz |
Restoring authorship annotation for Stanislav Kirillov <staskirillov@gmail.com>. Commit 2 of 2.
Diffstat (limited to 'util/stream/multi_ut.cpp')
-rw-r--r-- | util/stream/multi_ut.cpp | 84 |
1 files changed, 42 insertions, 42 deletions
diff --git a/util/stream/multi_ut.cpp b/util/stream/multi_ut.cpp index c9c328e5e3..fc2553b533 100644 --- a/util/stream/multi_ut.cpp +++ b/util/stream/multi_ut.cpp @@ -1,51 +1,51 @@ -#include "mem.h" -#include "multi.h" -#include "str.h" +#include "mem.h" +#include "multi.h" +#include "str.h" #include <library/cpp/testing/unittest/registar.h> - + Y_UNIT_TEST_SUITE(TestMultiInput) { - struct TTestCase { - TMemoryInput Input1; - TMemoryInput Input2; - TMultiInput MultiInput; + struct TTestCase { + TMemoryInput Input1; + TMemoryInput Input2; + TMultiInput MultiInput; TTestCase(const TStringBuf in1, const TStringBuf in2) - : Input1(in1) - , Input2(in2) - , MultiInput(&Input1, &Input2) - { - } - void TestReadToResult(char c, size_t expectedRetval, + : Input1(in1) + , Input2(in2) + , MultiInput(&Input1, &Input2) + { + } + void TestReadToResult(char c, size_t expectedRetval, const TString& expectedValue, const TString& initValue = "") { TString t = initValue; - UNIT_ASSERT_VALUES_EQUAL(MultiInput.ReadTo(t, c), expectedRetval); - UNIT_ASSERT_VALUES_EQUAL(t, expectedValue); - } - }; - + UNIT_ASSERT_VALUES_EQUAL(MultiInput.ReadTo(t, c), expectedRetval); + UNIT_ASSERT_VALUES_EQUAL(t, expectedValue); + } + }; + Y_UNIT_TEST(TestReadTo) { TString t; - - TTestCase simpleCase("0123456789abc", "defghijk"); - simpleCase.TestReadToResult('7', 8, "0123456"); - simpleCase.TestReadToResult('f', 8, "89abcde"); - simpleCase.TestReadToResult('z', 5, "ghijk"); - } - + + TTestCase simpleCase("0123456789abc", "defghijk"); + simpleCase.TestReadToResult('7', 8, "0123456"); + simpleCase.TestReadToResult('f', 8, "89abcde"); + simpleCase.TestReadToResult('z', 5, "ghijk"); + } + Y_UNIT_TEST(TestReadToBetweenStreams) { - TTestCase case1("0123456789abc", "defghijk"); - case1.TestReadToResult('c', 13, "0123456789ab"); - case1.TestReadToResult('k', 8, "defghij"); - case1.TestReadToResult('z', 0, "TRASH", "TRASH"); - - TTestCase case2("0123456789abc", "defghijk"); - case2.TestReadToResult('d', 14, "0123456789abc"); - case2.TestReadToResult('j', 6, "efghi"); - case2.TestReadToResult('k', 1, "", "TRASH"); - - TTestCase case3("0123456789abc", "defghijk"); - case3.TestReadToResult('e', 15, "0123456789abcd"); - case3.TestReadToResult('j', 5, "fghi"); - case3.TestReadToResult('k', 1, "", "TRASH"); - } -} + TTestCase case1("0123456789abc", "defghijk"); + case1.TestReadToResult('c', 13, "0123456789ab"); + case1.TestReadToResult('k', 8, "defghij"); + case1.TestReadToResult('z', 0, "TRASH", "TRASH"); + + TTestCase case2("0123456789abc", "defghijk"); + case2.TestReadToResult('d', 14, "0123456789abc"); + case2.TestReadToResult('j', 6, "efghi"); + case2.TestReadToResult('k', 1, "", "TRASH"); + + TTestCase case3("0123456789abc", "defghijk"); + case3.TestReadToResult('e', 15, "0123456789abcd"); + case3.TestReadToResult('j', 5, "fghi"); + case3.TestReadToResult('k', 1, "", "TRASH"); + } +} |