diff options
author | Vasily Gerasimov <UgnineSirdis@gmail.com> | 2022-02-10 16:49:09 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:49:09 +0300 |
commit | 6cdc8f140213c595e4ad38bc3d97fcef1146b8c3 (patch) | |
tree | f69637041e6fed76ebae0c74ae1fa0c4be6ab5b4 /util/generic | |
parent | e5d4696304c6689379ac7ce334512404d4b7836c (diff) | |
download | ydb-6cdc8f140213c595e4ad38bc3d97fcef1146b8c3.tar.gz |
Restoring authorship annotation for Vasily Gerasimov <UgnineSirdis@gmail.com>. Commit 1 of 2.
Diffstat (limited to 'util/generic')
-rw-r--r-- | util/generic/algorithm.h | 4 | ||||
-rw-r--r-- | util/generic/cast.h | 8 | ||||
-rw-r--r-- | util/generic/cast_ut.cpp | 2 | ||||
-rw-r--r-- | util/generic/is_in.h | 38 | ||||
-rw-r--r-- | util/generic/is_in_ut.cpp | 98 | ||||
-rw-r--r-- | util/generic/mem_copy_ut.cpp | 10 | ||||
-rw-r--r-- | util/generic/ptr.h | 44 | ||||
-rw-r--r-- | util/generic/ptr_ut.cpp | 124 | ||||
-rw-r--r-- | util/generic/strbuf.h | 12 | ||||
-rw-r--r-- | util/generic/strbuf_ut.cpp | 28 | ||||
-rw-r--r-- | util/generic/typetraits.h | 4 | ||||
-rw-r--r-- | util/generic/yexception_ut.cpp | 22 |
12 files changed, 197 insertions, 197 deletions
diff --git a/util/generic/algorithm.h b/util/generic/algorithm.h index badfb88993..8110469770 100644 --- a/util/generic/algorithm.h +++ b/util/generic/algorithm.h @@ -1,7 +1,7 @@ #pragma once -#include "is_in.h" -#include "utility.h" +#include "is_in.h" +#include "utility.h" #include <util/system/defaults.h> #include <util/generic/fwd.h> diff --git a/util/generic/cast.h b/util/generic/cast.h index 0d4a41f385..573e2fc1a8 100644 --- a/util/generic/cast.h +++ b/util/generic/cast.h @@ -117,13 +117,13 @@ inline std::enable_if_t<!::NPrivate::TSafelyConvertible<TSmall, TLarge>::Result, using TLargeInt = ::NPrivate::TUnderlyingTypeOrSelf<TLarge>; if (std::is_unsigned<TSmallInt>::value && std::is_signed<TLargeInt>::value) { - if (IsNegative(largeInt)) { + if (IsNegative(largeInt)) { ythrow TBadCastException() << "Conversion '" << TypeName<TLarge>() << '{' << TLargeInt(largeInt) << "}' to '" << TypeName<TSmallInt>() << "', negative value converted to unsigned"; - } - } - + } + } + TSmallInt smallInt = TSmallInt(largeInt); if (std::is_signed<TSmallInt>::value && std::is_unsigned<TLargeInt>::value) { diff --git a/util/generic/cast_ut.cpp b/util/generic/cast_ut.cpp index 718a8de79d..4113052202 100644 --- a/util/generic/cast_ut.cpp +++ b/util/generic/cast_ut.cpp @@ -16,7 +16,7 @@ private: virtual ~TAaa() = default; }; struct TBbb: public TAaa {}; - + inline void TestVerifyDynamicCast() { TBbb bbb; TAaa* aaa = &bbb; diff --git a/util/generic/is_in.h b/util/generic/is_in.h index 4f175ea5eb..5f1c6fc3b2 100644 --- a/util/generic/is_in.h +++ b/util/generic/is_in.h @@ -1,24 +1,24 @@ -#pragma once - -#include "typetraits.h" +#pragma once +#include "typetraits.h" + #include <algorithm> #include <initializer_list> - -template <class I, class T> + +template <class I, class T> static inline bool IsIn(I f, I l, const T& v); - -template <class C, class T> + +template <class C, class T> static inline bool IsIn(const C& c, const T& e); - -namespace NIsInHelper { + +namespace NIsInHelper { Y_HAS_MEMBER(find, FindMethod); Y_HAS_SUBTYPE(const_iterator, ConstIterator); Y_HAS_SUBTYPE(key_type, KeyType); - + template <class T> using TIsAssocCont = TConjunction<THasFindMethod<T>, THasConstIterator<T>, THasKeyType<T>>; - + template <class C, class T, bool isAssoc> struct TIsInTraits { static bool IsIn(const C& c, const T& e) { @@ -27,7 +27,7 @@ namespace NIsInHelper { return ::IsIn(begin(c), end(c), e); } }; - + template <class C, class T> struct TIsInTraits<C, T, true> { static bool IsIn(const C& c, const T& e) { @@ -35,17 +35,17 @@ namespace NIsInHelper { } }; } - -template <class I, class T> + +template <class I, class T> static inline bool IsIn(I f, I l, const T& v) { return std::find(f, l, v) != l; -} - -template <class C, class T> +} + +template <class C, class T> static inline bool IsIn(const C& c, const T& e) { - using namespace NIsInHelper; + using namespace NIsInHelper; return TIsInTraits<C, T, TIsAssocCont<C>::value>::IsIn(c, e); -} +} template <class T, class U> static inline bool IsIn(std::initializer_list<T> l, const U& e) { diff --git a/util/generic/is_in_ut.cpp b/util/generic/is_in_ut.cpp index c668bce807..49c14bff12 100644 --- a/util/generic/is_in_ut.cpp +++ b/util/generic/is_in_ut.cpp @@ -1,5 +1,5 @@ #include <library/cpp/testing/unittest/registar.h> - + #include "algorithm.h" #include "hash.h" #include "hash_set.h" @@ -8,68 +8,68 @@ #include "set.h" #include "strbuf.h" #include "string.h" - + Y_UNIT_TEST_SUITE(TIsIn) { template <class TCont, class T> - void TestIsInWithCont(const T& elem) { + void TestIsInWithCont(const T& elem) { class TMapMock: public TCont { - public: - typename TCont::const_iterator find(const typename TCont::key_type& k) const { - ++FindCalled; - return TCont::find(k); - } - - typename TCont::iterator find(const typename TCont::key_type& k) { - ++FindCalled; - return TCont::find(k); - } - - mutable size_t FindCalled = 1; - }; - - TMapMock m; - m.insert(elem); - - // use more effective find method - UNIT_ASSERT(IsIn(m, "found")); - UNIT_ASSERT(m.FindCalled); - m.FindCalled = 0; - - UNIT_ASSERT(!IsIn(m, "not found")); - UNIT_ASSERT(m.FindCalled); - m.FindCalled = 0; - } - + public: + typename TCont::const_iterator find(const typename TCont::key_type& k) const { + ++FindCalled; + return TCont::find(k); + } + + typename TCont::iterator find(const typename TCont::key_type& k) { + ++FindCalled; + return TCont::find(k); + } + + mutable size_t FindCalled = 1; + }; + + TMapMock m; + m.insert(elem); + + // use more effective find method + UNIT_ASSERT(IsIn(m, "found")); + UNIT_ASSERT(m.FindCalled); + m.FindCalled = 0; + + UNIT_ASSERT(!IsIn(m, "not found")); + UNIT_ASSERT(m.FindCalled); + m.FindCalled = 0; + } + Y_UNIT_TEST(IsInTest) { TestIsInWithCont<TMap<TString, TString>>(std::make_pair("found", "1")); TestIsInWithCont<TMultiMap<TString, TString>>(std::make_pair("found", "1")); TestIsInWithCont<THashMap<TString, TString>>(std::make_pair("found", "1")); TestIsInWithCont<THashMultiMap<TString, TString>>(std::make_pair("found", "1")); - + TestIsInWithCont<TSet<TString>>("found"); TestIsInWithCont<TMultiSet<TString>>("found"); TestIsInWithCont<THashSet<TString>>("found"); TestIsInWithCont<THashMultiSet<TString>>("found"); - - // vector also compiles and works + + // vector also compiles and works TVector<TString> v; - v.push_back("found"); - UNIT_ASSERT(IsIn(v, "found")); - UNIT_ASSERT(!IsIn(v, "not found")); - - // iterators interface - UNIT_ASSERT(IsIn(v.begin(), v.end(), "found")); - UNIT_ASSERT(!IsIn(v.begin(), v.end(), "not found")); - + v.push_back("found"); + UNIT_ASSERT(IsIn(v, "found")); + UNIT_ASSERT(!IsIn(v, "not found")); + + // iterators interface + UNIT_ASSERT(IsIn(v.begin(), v.end(), "found")); + UNIT_ASSERT(!IsIn(v.begin(), v.end(), "not found")); + // Works with TString (it has find, but find is not used) TString s = "found"; - UNIT_ASSERT(IsIn(s, 'f')); - UNIT_ASSERT(!IsIn(s, 'z')); - - TStringBuf b = "found"; - UNIT_ASSERT(IsIn(b, 'f')); - UNIT_ASSERT(!IsIn(b, 'z')); - } + UNIT_ASSERT(IsIn(s, 'f')); + UNIT_ASSERT(!IsIn(s, 'z')); + + TStringBuf b = "found"; + UNIT_ASSERT(IsIn(b, 'f')); + UNIT_ASSERT(!IsIn(b, 'z')); + } Y_UNIT_TEST(IsInInitListTest) { const char* abc = "abc"; @@ -113,4 +113,4 @@ Y_UNIT_TEST_SUITE(TIsIn) { UNIT_ASSERT(!IsIn(array, "c")); UNIT_ASSERT(IsIn(array, TStringBuf("d"))); } -} +} diff --git a/util/generic/mem_copy_ut.cpp b/util/generic/mem_copy_ut.cpp index 8b55a11cf6..050fd7fa18 100644 --- a/util/generic/mem_copy_ut.cpp +++ b/util/generic/mem_copy_ut.cpp @@ -3,12 +3,12 @@ #include <library/cpp/testing/unittest/registar.h> namespace { - class TAssignBCalled: public yexception { - }; - + class TAssignBCalled: public yexception { + }; + struct TB { inline TB& operator=(const TB&) { - throw TAssignBCalled(); + throw TAssignBCalled(); return *this; } @@ -69,7 +69,7 @@ Y_UNIT_TEST_SUITE(TestMemCopy) { TC c1[5]; TC c2[5]; - UNIT_ASSERT_EXCEPTION(MemCopy(c2, c1, 5), TAssignBCalled); + UNIT_ASSERT_EXCEPTION(MemCopy(c2, c1, 5), TAssignBCalled); } template <class T> diff --git a/util/generic/ptr.h b/util/generic/ptr.h index 19db0e3ec5..49a6fca6ae 100644 --- a/util/generic/ptr.h +++ b/util/generic/ptr.h @@ -602,17 +602,17 @@ private: mutable T* T_; }; -template <class T, class Ops> +template <class T, class Ops> struct THash<TIntrusivePtr<T, Ops>>: THash<const T*> { - using THash<const T*>::operator(); - inline size_t operator()(const TIntrusivePtr<T, Ops>& ptr) const { - return THash<const T*>::operator()(ptr.Get()); - } -}; - + using THash<const T*>::operator(); + inline size_t operator()(const TIntrusivePtr<T, Ops>& ptr) const { + return THash<const T*>::operator()(ptr.Get()); + } +}; + // Behaves like TIntrusivePtr but returns const T* to prevent user from accidentally modifying the referenced object. template <class T, class Ops> -class TIntrusiveConstPtr: public TPointerBase<TIntrusiveConstPtr<T, Ops>, const T> { +class TIntrusiveConstPtr: public TPointerBase<TIntrusiveConstPtr<T, Ops>, const T> { public: inline TIntrusiveConstPtr(T* t = nullptr) noexcept // we need a non-const pointer to Ref(), UnRef() and eventually delete it. : T_(t) @@ -718,13 +718,13 @@ private: template <class T, class Ops> struct THash<TIntrusiveConstPtr<T, Ops>>: THash<const T*> { - using THash<const T*>::operator(); - inline size_t operator()(const TIntrusiveConstPtr<T, Ops>& ptr) const { - return THash<const T*>::operator()(ptr.Get()); - } -}; - -template <class T, class Ops> + using THash<const T*>::operator(); + inline size_t operator()(const TIntrusiveConstPtr<T, Ops>& ptr) const { + return THash<const T*>::operator()(ptr.Get()); + } +}; + +template <class T, class Ops> class TSimpleIntrusiveOps { using TFunc = void (*)(T*) #if __cplusplus >= 201703 @@ -932,14 +932,14 @@ private: C* C_; }; -template <class T, class C, class D> +template <class T, class C, class D> struct THash<TSharedPtr<T, C, D>>: THash<const T*> { - using THash<const T*>::operator(); - inline size_t operator()(const TSharedPtr<T, C, D>& ptr) const { - return THash<const T*>::operator()(ptr.Get()); - } -}; - + using THash<const T*>::operator(); + inline size_t operator()(const TSharedPtr<T, C, D>& ptr) const { + return THash<const T*>::operator()(ptr.Get()); + } +}; + template <class T, class D = TDelete> using TAtomicSharedPtr = TSharedPtr<T, TAtomicCounter, D>; diff --git a/util/generic/ptr_ut.cpp b/util/generic/ptr_ut.cpp index c2dcff23f6..210e562a36 100644 --- a/util/generic/ptr_ut.cpp +++ b/util/generic/ptr_ut.cpp @@ -4,8 +4,8 @@ #include <library/cpp/testing/unittest/registar.h> -#include <util/generic/hash_set.h> -#include <util/generic/is_in.h> +#include <util/generic/hash_set.h> +#include <util/generic/is_in.h> #include <util/stream/output.h> #include <util/system/thread.h> @@ -31,9 +31,9 @@ class TPointerTest: public TTestBase { UNIT_TEST(TestCopyOnWritePtr2); UNIT_TEST(TestOperatorBool); UNIT_TEST(TestMakeShared); - UNIT_TEST(TestComparison); + UNIT_TEST(TestComparison); UNIT_TEST(TestSimpleIntrusivePtrCtorTsan); - UNIT_TEST(TestRefCountedPtrsInHashSet) + UNIT_TEST(TestRefCountedPtrsInHashSet) UNIT_TEST_SUITE_END(); private: @@ -83,10 +83,10 @@ private: void TestCopyOnWritePtr2(); void TestOperatorBool(); void TestMakeShared(); - void TestComparison(); - template <class T, class TRefCountedPtr> - void TestRefCountedPtrsInHashSetImpl(); - void TestRefCountedPtrsInHashSet(); + void TestComparison(); + template <class T, class TRefCountedPtr> + void TestRefCountedPtrsInHashSetImpl(); + void TestRefCountedPtrsInHashSet(); }; UNIT_TEST_SUITE_REGISTRATION(TPointerTest); @@ -709,73 +709,73 @@ void TPointerTest::TestMakeShared() { } } -template <class TPtr> -void TestPtrComparison(const TPtr& ptr) { - UNIT_ASSERT(ptr == ptr); - UNIT_ASSERT(!(ptr != ptr)); - UNIT_ASSERT(ptr == ptr.Get()); - UNIT_ASSERT(!(ptr != ptr.Get())); -} - -void TPointerTest::TestComparison() { +template <class TPtr> +void TestPtrComparison(const TPtr& ptr) { + UNIT_ASSERT(ptr == ptr); + UNIT_ASSERT(!(ptr != ptr)); + UNIT_ASSERT(ptr == ptr.Get()); + UNIT_ASSERT(!(ptr != ptr.Get())); +} + +void TPointerTest::TestComparison() { THolder<A> ptr1(new A); TAutoPtr<A> ptr2; TSimpleSharedPtr<int> ptr3(new int(6)); TIntrusivePtr<A> ptr4; - TIntrusiveConstPtr<A> ptr5 = ptr4; + TIntrusiveConstPtr<A> ptr5 = ptr4; UNIT_ASSERT(ptr1 != nullptr); UNIT_ASSERT(ptr2 == nullptr); UNIT_ASSERT(ptr3 != nullptr); UNIT_ASSERT(ptr4 == nullptr); - UNIT_ASSERT(ptr5 == nullptr); - - TestPtrComparison(ptr1); - TestPtrComparison(ptr2); - TestPtrComparison(ptr3); - TestPtrComparison(ptr4); - TestPtrComparison(ptr5); + UNIT_ASSERT(ptr5 == nullptr); + + TestPtrComparison(ptr1); + TestPtrComparison(ptr2); + TestPtrComparison(ptr3); + TestPtrComparison(ptr4); + TestPtrComparison(ptr5); } - -template <class T, class TRefCountedPtr> -void TPointerTest::TestRefCountedPtrsInHashSetImpl() { - THashSet<TRefCountedPtr> hashSet; - TRefCountedPtr p1(new T()); - UNIT_ASSERT(!IsIn(hashSet, p1)); - UNIT_ASSERT(hashSet.insert(p1).second); - UNIT_ASSERT(IsIn(hashSet, p1)); - UNIT_ASSERT_VALUES_EQUAL(hashSet.size(), 1); - UNIT_ASSERT(!hashSet.insert(p1).second); - - TRefCountedPtr p2(new T()); - UNIT_ASSERT(!IsIn(hashSet, p2)); - UNIT_ASSERT(hashSet.insert(p2).second); - UNIT_ASSERT(IsIn(hashSet, p2)); - UNIT_ASSERT_VALUES_EQUAL(hashSet.size(), 2); -} - + +template <class T, class TRefCountedPtr> +void TPointerTest::TestRefCountedPtrsInHashSetImpl() { + THashSet<TRefCountedPtr> hashSet; + TRefCountedPtr p1(new T()); + UNIT_ASSERT(!IsIn(hashSet, p1)); + UNIT_ASSERT(hashSet.insert(p1).second); + UNIT_ASSERT(IsIn(hashSet, p1)); + UNIT_ASSERT_VALUES_EQUAL(hashSet.size(), 1); + UNIT_ASSERT(!hashSet.insert(p1).second); + + TRefCountedPtr p2(new T()); + UNIT_ASSERT(!IsIn(hashSet, p2)); + UNIT_ASSERT(hashSet.insert(p2).second); + UNIT_ASSERT(IsIn(hashSet, p2)); + UNIT_ASSERT_VALUES_EQUAL(hashSet.size(), 2); +} + struct TCustomIntrusivePtrOps: TDefaultIntrusivePtrOps<A> { -}; - +}; + struct TCustomDeleter: TDelete { -}; - +}; + struct TCustomCounter: TSimpleCounter { - using TSimpleCounterTemplate::TSimpleCounterTemplate; -}; - -void TPointerTest::TestRefCountedPtrsInHashSet() { - // test common case - TestRefCountedPtrsInHashSetImpl<TString, TSimpleSharedPtr<TString>>(); - TestRefCountedPtrsInHashSetImpl<TString, TAtomicSharedPtr<TString>>(); - TestRefCountedPtrsInHashSetImpl<A, TIntrusivePtr<A>>(); - TestRefCountedPtrsInHashSetImpl<A, TIntrusiveConstPtr<A>>(); - - // test with custom ops - TestRefCountedPtrsInHashSetImpl<TString, TSharedPtr<TString, TCustomCounter, TCustomDeleter>>(); - TestRefCountedPtrsInHashSetImpl<A, TIntrusivePtr<A, TCustomIntrusivePtrOps>>(); - TestRefCountedPtrsInHashSetImpl<A, TIntrusiveConstPtr<A, TCustomIntrusivePtrOps>>(); -} + using TSimpleCounterTemplate::TSimpleCounterTemplate; +}; + +void TPointerTest::TestRefCountedPtrsInHashSet() { + // test common case + TestRefCountedPtrsInHashSetImpl<TString, TSimpleSharedPtr<TString>>(); + TestRefCountedPtrsInHashSetImpl<TString, TAtomicSharedPtr<TString>>(); + TestRefCountedPtrsInHashSetImpl<A, TIntrusivePtr<A>>(); + TestRefCountedPtrsInHashSetImpl<A, TIntrusiveConstPtr<A>>(); + + // test with custom ops + TestRefCountedPtrsInHashSetImpl<TString, TSharedPtr<TString, TCustomCounter, TCustomDeleter>>(); + TestRefCountedPtrsInHashSetImpl<A, TIntrusivePtr<A, TCustomIntrusivePtrOps>>(); + TestRefCountedPtrsInHashSetImpl<A, TIntrusiveConstPtr<A, TCustomIntrusivePtrOps>>(); +} class TRefCountedWithStatistics: public TNonCopyable { public: diff --git a/util/generic/strbuf.h b/util/generic/strbuf.h index 70b9360d58..390f30e53d 100644 --- a/util/generic/strbuf.h +++ b/util/generic/strbuf.h @@ -456,13 +456,13 @@ public: // string subsequences return *this; } - // coverity[exn_spec_violation] + // coverity[exn_spec_violation] inline TdSelf& Trunc(size_t targetSize) noexcept { - // Coverity false positive issue - // exn_spec_violation: An exception of type "std::out_of_range" is thrown but the exception specification "noexcept" doesn't allow it to be thrown. This will result in a call to terminate(). - // fun_call_w_exception: Called function TStringView::substr throws an exception of type "std::out_of_range". - // Suppress this issue because we pass argument pos=0 and string_view can't throw std::out_of_range. - *this = TStringView::substr(0, targetSize); //WARN: removing TStringView:: will lead to an infinite recursion + // Coverity false positive issue + // exn_spec_violation: An exception of type "std::out_of_range" is thrown but the exception specification "noexcept" doesn't allow it to be thrown. This will result in a call to terminate(). + // fun_call_w_exception: Called function TStringView::substr throws an exception of type "std::out_of_range". + // Suppress this issue because we pass argument pos=0 and string_view can't throw std::out_of_range. + *this = TStringView::substr(0, targetSize); //WARN: removing TStringView:: will lead to an infinite recursion return *this; } diff --git a/util/generic/strbuf_ut.cpp b/util/generic/strbuf_ut.cpp index 69cde785af..01d88d1b9f 100644 --- a/util/generic/strbuf_ut.cpp +++ b/util/generic/strbuf_ut.cpp @@ -332,20 +332,20 @@ Y_UNIT_TEST_SUITE(TStrBufTest) { char data[] = "Hello\0word"; PassByConstReference(data); } - - Y_UNIT_TEST(TestTruncate) { - TStringBuf s = "123"; - s.Trunc(5); - UNIT_ASSERT_STRINGS_EQUAL(s, "123"); - s.Trunc(3); - UNIT_ASSERT_STRINGS_EQUAL(s, "123"); - s.Trunc(1); - UNIT_ASSERT_STRINGS_EQUAL(s, "1"); - s.Trunc(0); - UNIT_ASSERT_STRINGS_EQUAL(s, ""); - s.Trunc(0); - UNIT_ASSERT_STRINGS_EQUAL(s, ""); - } + + Y_UNIT_TEST(TestTruncate) { + TStringBuf s = "123"; + s.Trunc(5); + UNIT_ASSERT_STRINGS_EQUAL(s, "123"); + s.Trunc(3); + UNIT_ASSERT_STRINGS_EQUAL(s, "123"); + s.Trunc(1); + UNIT_ASSERT_STRINGS_EQUAL(s, "1"); + s.Trunc(0); + UNIT_ASSERT_STRINGS_EQUAL(s, ""); + s.Trunc(0); + UNIT_ASSERT_STRINGS_EQUAL(s, ""); + } } Y_UNIT_TEST_SUITE(TWtrBufTest) { diff --git a/util/generic/typetraits.h b/util/generic/typetraits.h index d165bd1a06..26ddb039d2 100644 --- a/util/generic/typetraits.h +++ b/util/generic/typetraits.h @@ -198,9 +198,9 @@ class TTypeTraits<void>: public TTypeTraitsBase<void> {}; struct THas##name: std::false_type {}; \ template <class T> \ struct THas##name<T, ::TVoidT<typename T::subtype>>: std::true_type {}; - + #define Y_HAS_SUBTYPE_IMPL_1(name) Y_HAS_SUBTYPE_IMPL_2(name, name) - + /* @def Y_HAS_SUBTYPE * * This macro should be used to define compile-time introspection helper classes for template diff --git a/util/generic/yexception_ut.cpp b/util/generic/yexception_ut.cpp index cb3e29fed8..f8560cde23 100644 --- a/util/generic/yexception_ut.cpp +++ b/util/generic/yexception_ut.cpp @@ -1,11 +1,11 @@ #include "yexception.h" static inline void Throw1DontMove() { - ythrow yexception() << "blabla"; // don't move this line + ythrow yexception() << "blabla"; // don't move this line } static inline void Throw2DontMove() { - ythrow yexception() << 1 << " qw " << 12.1; // don't move this line + ythrow yexception() << 1 << " qw " << 12.1; // don't move this line } #include <library/cpp/testing/unittest/registar.h> @@ -14,7 +14,7 @@ static inline void Throw2DontMove() { #include <util/memory/tempbuf.h> #include <util/random/mersenne.h> #include <util/stream/output.h> -#include <util/string/subst.h> +#include <util/string/subst.h> #include "yexception_ut.h" #include "bt_exception.h" @@ -218,18 +218,18 @@ private: } } - static inline void CheckCurrentExceptionContains(const char* message) { + static inline void CheckCurrentExceptionContains(const char* message) { TString err = CurrentExceptionMessage(); - SubstGlobal(err, '\\', '/'); // remove backslashes from path in message - UNIT_ASSERT(err.Contains(message)); - } - + SubstGlobal(err, '\\', '/'); // remove backslashes from path in message + UNIT_ASSERT(err.Contains(message)); + } + inline void TestRaise1() { try { Throw2DontMove(); UNIT_ASSERT(false); } catch (...) { - CheckCurrentExceptionContains("util/generic/yexception_ut.cpp:8: 1 qw 12.1"); + CheckCurrentExceptionContains("util/generic/yexception_ut.cpp:8: 1 qw 12.1"); } } @@ -240,9 +240,9 @@ private: inline void TestLineInfo() { try { Throw1DontMove(); - UNIT_ASSERT(false); + UNIT_ASSERT(false); } catch (...) { - CheckCurrentExceptionContains("util/generic/yexception_ut.cpp:4: blabla"); + CheckCurrentExceptionContains("util/generic/yexception_ut.cpp:4: blabla"); throw; } |