diff options
author | kaa <kaa@yandex-team.ru> | 2022-02-10 16:49:28 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:49:28 +0300 |
commit | f49cf886c755668578b0214ab9eae8ecdc1395a8 (patch) | |
tree | 5d5cb817648f650d76cf1076100726fd9b8448e8 | |
parent | b99e8e1b6e3468f81111414c917adc2d334b2c3c (diff) | |
download | ydb-f49cf886c755668578b0214ab9eae8ecdc1395a8.tar.gz |
Restoring authorship annotation for <kaa@yandex-team.ru>. Commit 2 of 2.
-rw-r--r-- | library/cpp/binsaver/bin_saver.h | 6 | ||||
-rw-r--r-- | library/cpp/getopt/ut/last_getopt_ut.cpp | 20 | ||||
-rw-r--r-- | library/cpp/testing/unittest/registar.h | 8 | ||||
-rw-r--r-- | util/string/join.h | 28 | ||||
-rw-r--r-- | util/string/join_ut.cpp | 24 | ||||
-rw-r--r-- | util/string/split.h | 30 | ||||
-rw-r--r-- | util/string/split_ut.cpp | 10 |
7 files changed, 63 insertions, 63 deletions
diff --git a/library/cpp/binsaver/bin_saver.h b/library/cpp/binsaver/bin_saver.h index f4f194ed0c..412424889f 100644 --- a/library/cpp/binsaver/bin_saver.h +++ b/library/cpp/binsaver/bin_saver.h @@ -126,7 +126,7 @@ private: if (nSize > 0) DataChunk(&data[0], sizeof(T) * nSize); } - + template <class AM> void DoAnyMap(AM& data) { if (IsReading()) { @@ -346,8 +346,8 @@ public: template <class T1, class T2, class T3, class T4> int Add(const chunk_id, TMap<T1, T2, T3, T4>* pMap) { DoAnyMap(*pMap); - return 0; - } + return 0; + } template <class T1, class T2, class T3, class T4, class T5> int Add(const chunk_id, THashMap<T1, T2, T3, T4, T5>* pHash) { DoAnyMap(*pHash); diff --git a/library/cpp/getopt/ut/last_getopt_ut.cpp b/library/cpp/getopt/ut/last_getopt_ut.cpp index 086cbac9c6..c99a1d053d 100644 --- a/library/cpp/getopt/ut/last_getopt_ut.cpp +++ b/library/cpp/getopt/ut/last_getopt_ut.cpp @@ -456,21 +456,21 @@ Y_UNIT_TEST_SUITE(TLastGetoptTests) { Y_UNIT_TEST(TestSetFlag) { bool a = false, b = true, c = false, d = true; - - TOptsNoDefault opts; - opts.AddLongOption('a', "alpha").NoArgument().SetFlag(&a); - opts.AddLongOption('b', "beta").NoArgument().SetFlag(&b); + + TOptsNoDefault opts; + opts.AddLongOption('a', "alpha").NoArgument().SetFlag(&a); + opts.AddLongOption('b', "beta").NoArgument().SetFlag(&b); opts.AddCharOption('c').StoreTrue(&c); opts.AddCharOption('d').StoreTrue(&d); - + TOptsParseResultTestWrapper r(&opts, V({"cmd", "-a", "-c"})); - - UNIT_ASSERT(a); - UNIT_ASSERT(!b); + + UNIT_ASSERT(a); + UNIT_ASSERT(!b); UNIT_ASSERT(c); UNIT_ASSERT(!d); - } - + } + Y_UNIT_TEST(TestDefaultValue) { TOptsNoDefault opts; opts.AddLongOption("path").DefaultValue("/etc"); diff --git a/library/cpp/testing/unittest/registar.h b/library/cpp/testing/unittest/registar.h index e755969d73..44517a0092 100644 --- a/library/cpp/testing/unittest/registar.h +++ b/library/cpp/testing/unittest/registar.h @@ -458,7 +458,7 @@ public: \ } \ } while (false) -//strings +//strings #define UNIT_ASSERT_STRINGS_UNEQUAL_C(A, B, C) \ do { \ const TString _a(A); \ @@ -467,10 +467,10 @@ public: \ auto&& msg = Sprintf("%s == %s %s", ToString(_a).data(), ToString(_b).data(), (::TStringBuilder() << C).data()); \ UNIT_FAIL_IMPL("strings unequal assertion failed", msg); \ } \ - } while (false) + } while (false) + +#define UNIT_ASSERT_STRINGS_UNEQUAL(A, B) UNIT_ASSERT_STRINGS_UNEQUAL_C(A, B, "") -#define UNIT_ASSERT_STRINGS_UNEQUAL(A, B) UNIT_ASSERT_STRINGS_UNEQUAL_C(A, B, "") - //bool #define UNIT_ASSERT_C(A, C) \ do { \ diff --git a/util/string/join.h b/util/string/join.h index cb271d278c..b166fad1f3 100644 --- a/util/string/join.h +++ b/util/string/join.h @@ -1,10 +1,10 @@ -#pragma once - +#pragma once + #include <util/generic/string.h> -#include <util/generic/typetraits.h> +#include <util/generic/typetraits.h> #include <util/string/cast.h> #include "cast.h" - + /* * Default implementation of AppendToString uses a temporary TString object which is inefficient. You can overload it * for your type to speed up string joins. If you already have an Out() or operator<<() implementation you can simply @@ -30,18 +30,18 @@ inline std::enable_if_t<std::is_arithmetic<std::remove_cv_t<T>>::value, void> AppendToString(TBasicString<TCharType>& dst, const T& t) { char buf[512]; dst.append(buf, ToString<std::remove_cv_t<T>>(t, buf, sizeof(buf))); -} - +} + template <typename TCharType> inline void AppendToString(TBasicString<TCharType>& dst, const TCharType* t) { dst.append(t); -} - +} + template <typename TCharType> inline void AppendToString(TBasicString<TCharType>& dst, TBasicStringBuf<TCharType> t) { dst.append(t); -} - +} + namespace NPrivate { template <typename T> inline size_t GetLength(const T&) { @@ -73,8 +73,8 @@ namespace NPrivate { size_t GetAppendLength(const TStringBuf delim, const TFirst& f, const TRest&... r) { return delim.length() + ::NPrivate::GetLength(f) + ::NPrivate::GetAppendLength(delim, r...); } -} - +} + template <typename TCharType> inline void AppendJoinNoReserve(TBasicString<TCharType>&, TBasicStringBuf<TCharType>) { } @@ -130,7 +130,7 @@ namespace NPrivate { } return out; - } + } } // namespace NPrivate @@ -172,7 +172,7 @@ inline TBasicString<TCharType> JoinSeq(std::basic_string_view<TCharType> delim, using std::begin; using std::end; return JoinRange(delim, begin(data), end(data)); -} +} template <typename TCharType, typename TContainer> inline TBasicString<TCharType> JoinSeq(const TCharType* delim, const TContainer& data) { diff --git a/util/string/join_ut.cpp b/util/string/join_ut.cpp index 3604e75a4e..3ed2b2459c 100644 --- a/util/string/join_ut.cpp +++ b/util/string/join_ut.cpp @@ -1,10 +1,10 @@ -#include "join.h" - +#include "join.h" + #include <library/cpp/testing/unittest/registar.h> -#include <util/generic/vector.h> - +#include <util/generic/vector.h> + #include <util/stream/output.h> - + struct TCustomData { TVector<int> Ints; }; @@ -16,7 +16,7 @@ TString ToString(const TCustomData& d) { 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"); @@ -24,19 +24,19 @@ Y_UNIT_TEST_SUITE(JoinStringTest) { 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}; + int v[] = {1, 2, 3}; TVector<int> vv(v, v + 3); - UNIT_ASSERT_EQUAL(JoinSeq(" ", vv), "1 2 3"); - UNIT_ASSERT_EQUAL(JoinSeq(" ", vv), JoinRange(" ", vv.begin(), vv.end())); + UNIT_ASSERT_EQUAL(JoinSeq(" ", vv), "1 2 3"); + UNIT_ASSERT_EQUAL(JoinSeq(" ", vv), JoinRange(" ", vv.begin(), vv.end())); UNIT_ASSERT_EQUAL(JoinRange(" ", v, v + 2), "1 2"); UNIT_ASSERT_EQUAL(JoinSeq(" ", {}), ""); UNIT_ASSERT_EQUAL(JoinSeq(" ", {42}), "42"); 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 @@ -160,4 +160,4 @@ Y_UNIT_TEST_SUITE(JoinStringTest) { UNIT_ASSERT_EQUAL(Join('a', 'a', 'a'), "97a97"); UNIT_ASSERT_EQUAL(Join("a", "a", "a"), "aaa"); } -} +} diff --git a/util/string/split.h b/util/string/split.h index 29fafd7890..bc46d9e64c 100644 --- a/util/string/split.h +++ b/util/string/split.h @@ -10,7 +10,7 @@ #include <util/generic/store_policy.h> #include <util/generic/strbuf.h> #include <util/generic/string.h> -#include <util/generic/typetraits.h> +#include <util/generic/typetraits.h> #include <util/generic/vector.h> #include <util/generic/ylimits.h> #include <util/system/compat.h> @@ -260,28 +260,28 @@ struct TSetDelimiter: private TFindFirstOf<const Char> { } }; -namespace NSplitTargetHasPushBack { +namespace NSplitTargetHasPushBack { Y_HAS_MEMBER(push_back, PushBack); -} - +} + template <class T, class = void> struct TConsumerBackInserter; - + template <class T> struct TConsumerBackInserter<T, std::enable_if_t<NSplitTargetHasPushBack::TClassHasPushBack<T>::value>> { static void DoInsert(T* C, const typename T::value_type& i) { - C->push_back(i); - } -}; - -template <class T> + C->push_back(i); + } +}; + +template <class T> struct TConsumerBackInserter<T, std::enable_if_t<!NSplitTargetHasPushBack::TClassHasPushBack<T>::value>> { static void DoInsert(T* C, const typename T::value_type& i) { - C->insert(C->end(), i); - } -}; - -template <class T> + C->insert(C->end(), i); + } +}; + +template <class T> struct TContainerConsumer { inline TContainerConsumer(T* c) noexcept : C(c) diff --git a/util/string/split_ut.cpp b/util/string/split_ut.cpp index 02b00b95a9..43e59f2d75 100644 --- a/util/string/split_ut.cpp +++ b/util/string/split_ut.cpp @@ -25,7 +25,7 @@ static inline void OldSplit(char* pszBuf, T* pRes) { template <class T1, class T2> inline void Cmp(const T1& t1, const T2& t2) { try { - UNIT_ASSERT_EQUAL(t1.size(), t2.size()); + UNIT_ASSERT_EQUAL(t1.size(), t2.size()); } catch (...) { Print(t1); Cerr << "---------------" << Endl; @@ -39,9 +39,9 @@ inline void Cmp(const T1& t1, const T2& t2) { for (; i != t1.end() && j != t2.end(); ++i, ++j) { try { - UNIT_ASSERT_EQUAL(*i, *j); + UNIT_ASSERT_EQUAL(*i, *j); } catch (...) { - Cerr << "(" << *i << ")->(" << *j << ")" << Endl; + Cerr << "(" << *i << ")->(" << *j << ")" << Endl; throw; } @@ -50,8 +50,8 @@ inline void Cmp(const T1& t1, const T2& t2) { template <class T> inline void Print(const T& t) { - for (typename T::const_iterator i = t.begin(); i != t.end(); ++i) { - Cerr << *i << Endl; + for (typename T::const_iterator i = t.begin(); i != t.end(); ++i) { + Cerr << *i << Endl; } } |