diff options
author | tender-bum <tender-bum@yandex-team.ru> | 2022-02-10 16:50:01 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:50:01 +0300 |
commit | c78b06a63de7beec995c1007bc5332bdf3d75b69 (patch) | |
tree | 729de992758f40b85278d4abaad655be5dd68dbc /util/generic/maybe_ut.cpp | |
parent | 95ab23a39b5482a434361566cabdd5b0a433cb43 (diff) | |
download | ydb-c78b06a63de7beec995c1007bc5332bdf3d75b69.tar.gz |
Restoring authorship annotation for <tender-bum@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'util/generic/maybe_ut.cpp')
-rw-r--r-- | util/generic/maybe_ut.cpp | 98 |
1 files changed, 49 insertions, 49 deletions
diff --git a/util/generic/maybe_ut.cpp b/util/generic/maybe_ut.cpp index 2c1a425c5e..8eb9de6426 100644 --- a/util/generic/maybe_ut.cpp +++ b/util/generic/maybe_ut.cpp @@ -21,24 +21,24 @@ public: }; Y_UNIT_TEST_SUITE(TMaybeTest) { - Y_UNIT_TEST(TestStatic) { - using T1 = TMaybe<int>; - static_assert(std::is_trivially_copy_constructible<T1>::value, ""); - static_assert(std::is_trivially_destructible<T1>::value, ""); - - using T2 = TMaybe<TString*>; - static_assert(std::is_trivially_copy_constructible<T2>::value, ""); - static_assert(std::is_trivially_destructible<T2>::value, ""); - - using T3 = TMaybe<TMaybe<double>>; - static_assert(std::is_trivially_copy_constructible<T3>::value, ""); - static_assert(std::is_trivially_destructible<T3>::value, ""); - - using T4 = TMaybe<TString>; - static_assert(!std::is_trivially_copy_constructible<T4>::value, ""); - static_assert(!std::is_trivially_destructible<T4>::value, ""); - } - + Y_UNIT_TEST(TestStatic) { + using T1 = TMaybe<int>; + static_assert(std::is_trivially_copy_constructible<T1>::value, ""); + static_assert(std::is_trivially_destructible<T1>::value, ""); + + using T2 = TMaybe<TString*>; + static_assert(std::is_trivially_copy_constructible<T2>::value, ""); + static_assert(std::is_trivially_destructible<T2>::value, ""); + + using T3 = TMaybe<TMaybe<double>>; + static_assert(std::is_trivially_copy_constructible<T3>::value, ""); + static_assert(std::is_trivially_destructible<T3>::value, ""); + + using T4 = TMaybe<TString>; + static_assert(!std::is_trivially_copy_constructible<T4>::value, ""); + static_assert(!std::is_trivially_destructible<T4>::value, ""); + } + Y_UNIT_TEST(TestWarning) { TMaybe<size_t> x; TStringStream ss; @@ -136,9 +136,9 @@ Y_UNIT_TEST_SUITE(TMaybeTest) { UNIT_ASSERT(m5 == TMaybe<int>()); UNIT_ASSERT(m5 == Nothing()); UNIT_ASSERT(m5 != TMaybe<int>(5)); - - m5 = {}; - UNIT_ASSERT(m5.Empty()); + + m5 = {}; + UNIT_ASSERT(m5.Empty()); } Y_UNIT_TEST(TestInPlace) { @@ -964,40 +964,40 @@ Y_UNIT_TEST_SUITE(TMaybeTest) { UNIT_ASSERT_EQUAL(testStructMaybe.GetRef().From_, TestStruct::FromValue); UNIT_ASSERT_EQUAL(testStructMaybe.GetRef().Value_, 23); } - - Y_UNIT_TEST(TestMaybeConvertion) { - struct TSrc {}; - struct TDst { - bool FromMaybeConstructorApplied; - - explicit TDst(TSrc) + + Y_UNIT_TEST(TestMaybeConvertion) { + struct TSrc {}; + struct TDst { + bool FromMaybeConstructorApplied; + + explicit TDst(TSrc) : FromMaybeConstructorApplied(false) { } - - explicit TDst(TMaybe<TSrc>) + + explicit TDst(TMaybe<TSrc>) : FromMaybeConstructorApplied(true) { } - - TDst& operator=(TSrc) { - FromMaybeConstructorApplied = false; - return *this; - } - TDst& operator=(TMaybe<TSrc>) { - FromMaybeConstructorApplied = true; - return *this; - } - }; - - auto m = TMaybe<TDst>(TMaybe<TSrc>()); - UNIT_ASSERT(m.Defined()); - UNIT_ASSERT(m->FromMaybeConstructorApplied); - - m = TMaybe<TSrc>(); - UNIT_ASSERT(m.Defined()); - UNIT_ASSERT(m->FromMaybeConstructorApplied); - } + + TDst& operator=(TSrc) { + FromMaybeConstructorApplied = false; + return *this; + } + TDst& operator=(TMaybe<TSrc>) { + FromMaybeConstructorApplied = true; + return *this; + } + }; + + auto m = TMaybe<TDst>(TMaybe<TSrc>()); + UNIT_ASSERT(m.Defined()); + UNIT_ASSERT(m->FromMaybeConstructorApplied); + + m = TMaybe<TSrc>(); + UNIT_ASSERT(m.Defined()); + UNIT_ASSERT(m->FromMaybeConstructorApplied); + } Y_UNIT_TEST(TestOnEmptyException) { TMaybe<TStringBuf> v; |