diff options
author | myltsev <myltsev@yandex-team.ru> | 2022-02-10 16:46:03 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:46:03 +0300 |
commit | fc361854fd6ee8d747229b090f0b8018e260d1fb (patch) | |
tree | 1a2c5ffcf89eb53ecd79dbc9bc0a195c27404d0c /util/generic | |
parent | 9166d66c30c23c9e85a7c88185a068987148d23f (diff) | |
download | ydb-fc361854fd6ee8d747229b090f0b8018e260d1fb.tar.gz |
Restoring authorship annotation for <myltsev@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'util/generic')
-rw-r--r-- | util/generic/mapfindptr.h | 8 | ||||
-rw-r--r-- | util/generic/mapfindptr_ut.cpp | 10 | ||||
-rw-r--r-- | util/generic/strbuf.h | 10 | ||||
-rw-r--r-- | util/generic/strbuf_ut.cpp | 20 | ||||
-rw-r--r-- | util/generic/string_ut.cpp | 2 |
5 files changed, 25 insertions, 25 deletions
diff --git a/util/generic/mapfindptr.h b/util/generic/mapfindptr.h index 98aad17984..bc10cac60f 100644 --- a/util/generic/mapfindptr.h +++ b/util/generic/mapfindptr.h @@ -36,14 +36,14 @@ struct TMapOps { inline auto FindPtr(const K& key) const { return MapFindPtr(static_cast<const Derived&>(*this), key); } - + template <class K, class DefaultValue> inline auto Value(const K& key, const DefaultValue& defaultValue) const -> std::remove_reference_t<decltype(*this->FindPtr(key))> { if (auto found = FindPtr(key)) { - return *found; - } + return *found; + } return defaultValue; - } + } template <class K, class V> inline const V& ValueRef(const K& key, V& defaultValue) const { diff --git a/util/generic/mapfindptr_ut.cpp b/util/generic/mapfindptr_ut.cpp index 52a7c23794..613da7a96b 100644 --- a/util/generic/mapfindptr_ut.cpp +++ b/util/generic/mapfindptr_ut.cpp @@ -29,9 +29,9 @@ Y_UNIT_TEST_SUITE(TMapFindPtrTest) { const TTestMap& b = a; UNIT_ASSERT(b.FindPtr(42) && *b.FindPtr(42) == "dog"); UNIT_ASSERT_EQUAL(b.FindPtr(0), nullptr); - - UNIT_ASSERT_STRINGS_EQUAL(b.Value(42, "cat"), "dog"); - UNIT_ASSERT_STRINGS_EQUAL(b.Value(0, "alien"), "alien"); + + UNIT_ASSERT_STRINGS_EQUAL(b.Value(42, "cat"), "dog"); + UNIT_ASSERT_STRINGS_EQUAL(b.Value(0, "alien"), "alien"); } Y_UNIT_TEST(TestTemplateFind) { @@ -39,8 +39,8 @@ Y_UNIT_TEST_SUITE(TMapFindPtrTest) { m[TString("x")] = 2; - UNIT_ASSERT(m.FindPtr(TStringBuf("x"))); - UNIT_ASSERT_EQUAL(*m.FindPtr(TStringBuf("x")), 2); + UNIT_ASSERT(m.FindPtr(TStringBuf("x"))); + UNIT_ASSERT_EQUAL(*m.FindPtr(TStringBuf("x")), 2); } Y_UNIT_TEST(TestValue) { diff --git a/util/generic/strbuf.h b/util/generic/strbuf.h index f1b4e654c5..70b9360d58 100644 --- a/util/generic/strbuf.h +++ b/util/generic/strbuf.h @@ -303,20 +303,20 @@ public: } Y_PURE_FUNCTION inline TdSelf Before(TCharType c) const noexcept { - TdSelf l, r; + TdSelf l, r; return TrySplit(c, l, r) ? l : *this; } - + Y_PURE_FUNCTION inline TdSelf RAfter(TCharType c) const noexcept { TdSelf l, r; return TryRSplit(c, l, r) ? r : *this; } Y_PURE_FUNCTION inline TdSelf RBefore(TCharType c) const noexcept { - TdSelf l, r; + TdSelf l, r; return TryRSplit(c, l, r) ? l : *this; - } - + } + public: inline bool AfterPrefix(const TdSelf& prefix, TdSelf& result) const noexcept { if (this->StartsWith(prefix)) { diff --git a/util/generic/strbuf_ut.cpp b/util/generic/strbuf_ut.cpp index 695ca33b06..69cde785af 100644 --- a/util/generic/strbuf_ut.cpp +++ b/util/generic/strbuf_ut.cpp @@ -55,7 +55,7 @@ Y_UNIT_TEST_SUITE(TStrBufTest) { UNIT_ASSERT_VALUES_EQUAL(str.After('w'), TStringBuf("erty")); UNIT_ASSERT_VALUES_EQUAL(str.After('x'), TStringBuf("qwerty")); UNIT_ASSERT_VALUES_EQUAL(str.After('y'), TStringBuf()); - UNIT_ASSERT_STRINGS_EQUAL(str.After('='), str); + UNIT_ASSERT_STRINGS_EQUAL(str.After('='), str); // Also works properly on empty strings TStringBuf empty; @@ -72,15 +72,15 @@ Y_UNIT_TEST_SUITE(TStrBufTest) { } Y_UNIT_TEST(TestRAfterBefore) { - TStringBuf str("a/b/c"); - UNIT_ASSERT_STRINGS_EQUAL(str.RAfter('/'), "c"); - UNIT_ASSERT_STRINGS_EQUAL(str.RAfter('_'), str); - UNIT_ASSERT_STRINGS_EQUAL(str.RAfter('a'), "/b/c"); - UNIT_ASSERT_STRINGS_EQUAL(str.RBefore('/'), "a/b"); - UNIT_ASSERT_STRINGS_EQUAL(str.RBefore('_'), str); - UNIT_ASSERT_STRINGS_EQUAL(str.RBefore('a'), ""); - } - + TStringBuf str("a/b/c"); + UNIT_ASSERT_STRINGS_EQUAL(str.RAfter('/'), "c"); + UNIT_ASSERT_STRINGS_EQUAL(str.RAfter('_'), str); + UNIT_ASSERT_STRINGS_EQUAL(str.RAfter('a'), "/b/c"); + UNIT_ASSERT_STRINGS_EQUAL(str.RBefore('/'), "a/b"); + UNIT_ASSERT_STRINGS_EQUAL(str.RBefore('_'), str); + UNIT_ASSERT_STRINGS_EQUAL(str.RBefore('a'), ""); + } + Y_UNIT_TEST(TestAfterPrefix) { TStringBuf str("cat_dog"); diff --git a/util/generic/string_ut.cpp b/util/generic/string_ut.cpp index 775e571b42..ac82e9091d 100644 --- a/util/generic/string_ut.cpp +++ b/util/generic/string_ut.cpp @@ -32,7 +32,7 @@ public: UNIT_ASSERT(s.size() == sizeof(data)); UNIT_ASSERT(s.StartsWith(s)); UNIT_ASSERT(s.EndsWith(s)); - UNIT_ASSERT(s.Contains('\0')); + UNIT_ASSERT(s.Contains('\0')); const char raw_def[] = "def"; const char raw_zero[] = "\0"; |