diff options
author | yuliy <yuliy@yandex-team.ru> | 2022-02-10 16:50:10 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:50:10 +0300 |
commit | df5f2b17d65c239ec8d68fdf518fcbea2bcc0bfe (patch) | |
tree | cc7288225ae23e459fe89ae954054ab490ae214c /library/cpp/deprecated/split/delim_string_iter_ut.cpp | |
parent | 7cba2edf1dbe4bc03ee23552d0a418bf48eb3a13 (diff) | |
download | ydb-df5f2b17d65c239ec8d68fdf518fcbea2bcc0bfe.tar.gz |
Restoring authorship annotation for <yuliy@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'library/cpp/deprecated/split/delim_string_iter_ut.cpp')
-rw-r--r-- | library/cpp/deprecated/split/delim_string_iter_ut.cpp | 56 |
1 files changed, 28 insertions, 28 deletions
diff --git a/library/cpp/deprecated/split/delim_string_iter_ut.cpp b/library/cpp/deprecated/split/delim_string_iter_ut.cpp index 18a8b2a160..a0ec436186 100644 --- a/library/cpp/deprecated/split/delim_string_iter_ut.cpp +++ b/library/cpp/deprecated/split/delim_string_iter_ut.cpp @@ -50,50 +50,50 @@ Y_UNIT_TEST_SUITE(TDelimStrokaIterTestSuite) { UNIT_ASSERT_EQUAL(got, expected); } } - -static void AssertKeyValueStringSplit( + +static void AssertKeyValueStringSplit( const TStringBuf str, const TStringBuf delim, const TVector<std::pair<TStringBuf, TStringBuf>>& expected) { TKeyValueDelimStringIter it(str, delim); - - for (const auto& expectedKeyValue : expected) { - UNIT_ASSERT(it.Valid()); - UNIT_ASSERT_STRINGS_EQUAL(it.Key(), expectedKeyValue.first); - UNIT_ASSERT_STRINGS_EQUAL(it.Value(), expectedKeyValue.second); - ++it; - } - UNIT_ASSERT(!it.Valid()); -} - + + for (const auto& expectedKeyValue : expected) { + UNIT_ASSERT(it.Valid()); + UNIT_ASSERT_STRINGS_EQUAL(it.Key(), expectedKeyValue.first); + UNIT_ASSERT_STRINGS_EQUAL(it.Value(), expectedKeyValue.second); + ++it; + } + UNIT_ASSERT(!it.Valid()); +} + Y_UNIT_TEST_SUITE(TKeyValueDelimStringIterTestSuite) { Y_UNIT_TEST(SingleCharacterAsDelimiter) { - AssertKeyValueStringSplit( - "abc=123,cde=qwer", ",", + AssertKeyValueStringSplit( + "abc=123,cde=qwer", ",", {{"abc", "123"}, {"cde", "qwer"}}); - } - + } + Y_UNIT_TEST(MultipleCharactersAsDelimiter) { - AssertKeyValueStringSplit( - "abc=xyz@@qwerty=zxcv", "@@", + AssertKeyValueStringSplit( + "abc=xyz@@qwerty=zxcv", "@@", {{"abc", "xyz"}, {"qwerty", "zxcv"}}); - } - + } + Y_UNIT_TEST(NoDelimiters) { - AssertKeyValueStringSplit( - "abc=zz", ",", + AssertKeyValueStringSplit( + "abc=zz", ",", {{"abc", "zz"}}); - } - + } + Y_UNIT_TEST(EmptyElements) { - AssertKeyValueStringSplit( - "@@abc=zxy@@@@qwerty=y@@", "@@", + AssertKeyValueStringSplit( + "@@abc=zxy@@@@qwerty=y@@", "@@", {{"", ""}, {"abc", "zxy"}, {"", ""}, {"qwerty", "y"}, {"", ""}}); - } -} + } +} |