diff options
author | mowgli <mowgli@yandex-team.ru> | 2022-02-10 16:49:25 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:49:25 +0300 |
commit | 56c39b3cf908e7202b1f7551a1653681e8015607 (patch) | |
tree | 5d5cb817648f650d76cf1076100726fd9b8448e8 /util/string/join_ut.cpp | |
parent | 89afbbe4ca0e02e386dd4df08f7945f190dc1b84 (diff) | |
download | ydb-56c39b3cf908e7202b1f7551a1653681e8015607.tar.gz |
Restoring authorship annotation for <mowgli@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'util/string/join_ut.cpp')
-rw-r--r-- | util/string/join_ut.cpp | 44 |
1 files changed, 22 insertions, 22 deletions
diff --git a/util/string/join_ut.cpp b/util/string/join_ut.cpp index 8bd7545b2a..3ed2b2459c 100644 --- a/util/string/join_ut.cpp +++ b/util/string/join_ut.cpp @@ -5,27 +5,27 @@ #include <util/stream/output.h> -struct TCustomData { +struct TCustomData { TVector<int> Ints; -}; - +}; + TString ToString(const TCustomData& d) { - return JoinSeq("__", d.Ints); -} - + return JoinSeq("__", d.Ints); +} + Y_UNIT_TEST_SUITE(JoinStringTest) { Y_UNIT_TEST(ScalarItems) { - UNIT_ASSERT_EQUAL(Join(',', 10, 11.1, "foobar"), "10,11.1,foobar"); + UNIT_ASSERT_EQUAL(Join(',', 10, 11.1, "foobar"), "10,11.1,foobar"); UNIT_ASSERT_EQUAL(Join(", ", 10, 11.1, "foobar"), "10, 11.1, foobar"); UNIT_ASSERT_EQUAL(Join(", ", 10, 11.1, TString("foobar")), "10, 11.1, foobar"); - + UNIT_ASSERT_EQUAL(Join('#', 0, "a", "foobar", -1.4, TStringBuf("aaa")), "0#a#foobar#-1.4#aaa"); - UNIT_ASSERT_EQUAL(Join("", "", ""), ""); - UNIT_ASSERT_EQUAL(Join("", "a", "b", "c"), "abc"); - UNIT_ASSERT_EQUAL(Join("", "a", "b", "", "c"), "abc"); - UNIT_ASSERT_EQUAL(Join(" ", "a", "b", "", "c"), "a b c"); + UNIT_ASSERT_EQUAL(Join("", "", ""), ""); + UNIT_ASSERT_EQUAL(Join("", "a", "b", "c"), "abc"); + UNIT_ASSERT_EQUAL(Join("", "a", "b", "", "c"), "abc"); + UNIT_ASSERT_EQUAL(Join(" ", "a", "b", "", "c"), "a b c"); } - + Y_UNIT_TEST(IntContainerItems) { int v[] = {1, 2, 3}; TVector<int> vv(v, v + 3); @@ -37,7 +37,7 @@ Y_UNIT_TEST_SUITE(JoinStringTest) { UNIT_ASSERT_EQUAL(JoinSeq(" ", {1, 2, 3}), "1 2 3"); UNIT_ASSERT_VALUES_EQUAL(JoinSeq(" ", v), "1 2 3"); } - + Y_UNIT_TEST(StrContainerItems) { // try various overloads and template type arguments static const char* const result = "1 22 333"; @@ -151,13 +151,13 @@ Y_UNIT_TEST_SUITE(JoinStringTest) { Y_UNIT_TEST(CustomToString) { TCustomData d1{{1, 2, 3, 4, 5}}; TCustomData d2{{0, -1, -2}}; - UNIT_ASSERT_EQUAL(Join(" ", d1, d2), "1__2__3__4__5 0__-1__-2"); - } - + UNIT_ASSERT_EQUAL(Join(" ", d1, d2), "1__2__3__4__5 0__-1__-2"); + } + Y_UNIT_TEST(JoinChars) { - // Note that char delimeter is printed as single char string, - // but joined char values are printed as their numeric codes! O_o - UNIT_ASSERT_EQUAL(Join('a', 'a', 'a'), "97a97"); - UNIT_ASSERT_EQUAL(Join("a", "a", "a"), "aaa"); - } + // Note that char delimeter is printed as single char string, + // but joined char values are printed as their numeric codes! O_o + UNIT_ASSERT_EQUAL(Join('a', 'a', 'a'), "97a97"); + UNIT_ASSERT_EQUAL(Join("a", "a", "a"), "aaa"); + } } |