diff options
author | putilin <putilin@yandex-team.ru> | 2022-02-10 16:49:29 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:49:29 +0300 |
commit | 3a0b7cd78a1a8366b3944d8d1e11ef9bb52549bf (patch) | |
tree | 5d5cb817648f650d76cf1076100726fd9b8448e8 /util/string/split_ut.cpp | |
parent | d85af01a101a46c4381ba0c8d5785a43c8273afd (diff) | |
download | ydb-3a0b7cd78a1a8366b3944d8d1e11ef9bb52549bf.tar.gz |
Restoring authorship annotation for <putilin@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'util/string/split_ut.cpp')
-rw-r--r-- | util/string/split_ut.cpp | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/util/string/split_ut.cpp b/util/string/split_ut.cpp index 7bce999d7d..43e59f2d75 100644 --- a/util/string/split_ut.cpp +++ b/util/string/split_ut.cpp @@ -55,19 +55,19 @@ inline void Print(const T& t) { } } -template <template <typename> class TConsumer, typename TResult, typename I, typename TDelimiter> +template <template <typename> class TConsumer, typename TResult, typename I, typename TDelimiter> void TestDelimiterOnString(TResult& good, I* str, const TDelimiter& delim) { TResult test; - TConsumer<TResult> consumer(&test); + TConsumer<TResult> consumer(&test); SplitString(str, delim, consumer); Cmp(good, test); UNIT_ASSERT_EQUAL(good, test); } -template <template <typename> class TConsumer, typename TResult, typename I, typename TDelimiter> +template <template <typename> class TConsumer, typename TResult, typename I, typename TDelimiter> void TestDelimiterOnRange(TResult& good, I* b, I* e, const TDelimiter& delim) { TResult test; - TConsumer<TResult> consumer(&test); + TConsumer<TResult> consumer(&test); SplitString(b, e, delim, consumer); Cmp(good, test); UNIT_ASSERT_EQUAL(good, test); @@ -142,14 +142,14 @@ Y_UNIT_TEST_SUITE(SplitStringTest) { Y_UNIT_TEST(TestConvertToIntCharSingleDelimiter) { TString data("42 4242 -12345 0"); - i32 canonic[] = {42, 4242, -12345, 0}; + i32 canonic[] = {42, 4242, -12345, 0}; TVector<i32> good(canonic, canonic + 4); - TCharDelimiter<const char> delim(' '); - + TCharDelimiter<const char> delim(' '); + TestDelimiterOnString<TContainerConvertingConsumer>(good, data.data(), delim); TestDelimiterOnRange<TContainerConvertingConsumer>(good, data.data(), data.end(), delim); - } - + } + Y_UNIT_TEST(TestCharSkipEmpty) { TString data("qw ab qwabcab "); TString canonic[] = {"qw", "ab", "qwabcab"}; @@ -243,14 +243,14 @@ Y_UNIT_TEST_SUITE(SplitStringTest) { TVector<TString> good(canonic, canonic + 3); TString delim = "ab"; TVector<TString> test; - Split(data, delim, test); - Cmp(good, test); + Split(data, delim, test); + Cmp(good, test); TVector<TStringBuf> test1; Split(data, delim.data(), test1); Cmp(good, test1); - } - + } + Y_UNIT_TEST(ConvenientSplitTest) { TString data("abc 22 33.5 xyz"); TString str; @@ -263,7 +263,7 @@ Y_UNIT_TEST_SUITE(SplitStringTest) { UNIT_ASSERT_VALUES_EQUAL(num2, 33.5); UNIT_ASSERT_VALUES_EQUAL(strBuf, "xyz"); } - + Y_UNIT_TEST(ConvenientSplitTestWithMaybe) { TString data("abc 42"); TString str; |