diff options
author | the0 <the0@yandex-team.ru> | 2022-02-10 16:51:52 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:51:52 +0300 |
commit | 6ab3ef1bf61ea8fc15ead03026798320e25c5455 (patch) | |
tree | 1e7596e57f9b2c070185325ad557906741994ec6 /util/generic/lazy_value_ut.cpp | |
parent | 31b5d49128f87d4f12ef17f7e681620416030f5c (diff) | |
download | ydb-6ab3ef1bf61ea8fc15ead03026798320e25c5455.tar.gz |
Restoring authorship annotation for <the0@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'util/generic/lazy_value_ut.cpp')
-rw-r--r-- | util/generic/lazy_value_ut.cpp | 90 |
1 files changed, 45 insertions, 45 deletions
diff --git a/util/generic/lazy_value_ut.cpp b/util/generic/lazy_value_ut.cpp index f6135880c3c..faca68d03f6 100644 --- a/util/generic/lazy_value_ut.cpp +++ b/util/generic/lazy_value_ut.cpp @@ -42,53 +42,53 @@ Y_UNIT_TEST_SUITE(TLazyValueTestSuite) { UNIT_ASSERT_EQUAL(*notEmptyCopy, 5); } - struct TCopyCounter { - TCopyCounter(size_t& numCopies) - : NumCopies(&numCopies) - { - } - - TCopyCounter() = default; - - TCopyCounter(const TCopyCounter& other) - : NumCopies(other.NumCopies) - { - ++(*NumCopies); - } - - TCopyCounter(TCopyCounter&&) = default; - - TCopyCounter& operator=(const TCopyCounter& other) { - if (this == &other) { - return *this; - } - NumCopies = other.NumCopies; - ++(*NumCopies); - return *this; - } - - TCopyCounter& operator=(TCopyCounter&&) = default; - - size_t* NumCopies = nullptr; - }; - - Y_UNIT_TEST(TestLazyValueMoveValueInitialization) { - size_t numCopies = 0; - TCopyCounter counter{numCopies}; + struct TCopyCounter { + TCopyCounter(size_t& numCopies) + : NumCopies(&numCopies) + { + } + + TCopyCounter() = default; + + TCopyCounter(const TCopyCounter& other) + : NumCopies(other.NumCopies) + { + ++(*NumCopies); + } + + TCopyCounter(TCopyCounter&&) = default; + + TCopyCounter& operator=(const TCopyCounter& other) { + if (this == &other) { + return *this; + } + NumCopies = other.NumCopies; + ++(*NumCopies); + return *this; + } + + TCopyCounter& operator=(TCopyCounter&&) = default; + + size_t* NumCopies = nullptr; + }; + + Y_UNIT_TEST(TestLazyValueMoveValueInitialization) { + size_t numCopies = 0; + TCopyCounter counter{numCopies}; TLazyValue<TCopyCounter> value{[v = std::move(counter)]() mutable { return std::move(v); }}; - value.InitDefault(); - UNIT_ASSERT_EQUAL(numCopies, 0); - } - - Y_UNIT_TEST(TestLazyValueCopyValueInitialization) { - size_t numCopies = 0; - TCopyCounter counter{numCopies}; + value.InitDefault(); + UNIT_ASSERT_EQUAL(numCopies, 0); + } + + Y_UNIT_TEST(TestLazyValueCopyValueInitialization) { + size_t numCopies = 0; + TCopyCounter counter{numCopies}; TLazyValue<TCopyCounter> value{[&counter]() { return counter; }}; - UNIT_ASSERT_EQUAL(numCopies, 0); - value.InitDefault(); - UNIT_ASSERT_EQUAL(numCopies, 1); - } - + UNIT_ASSERT_EQUAL(numCopies, 0); + value.InitDefault(); + UNIT_ASSERT_EQUAL(numCopies, 1); + } + class TValueProvider { public: static size_t CountParseDataCalled; |