diff options
author | khlebnikov <khlebnikov@yandex-team.ru> | 2022-02-10 16:50:08 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:50:08 +0300 |
commit | df35d89845ad252e6db1c6adf84da9b15de0e3b3 (patch) | |
tree | 5d5cb817648f650d76cf1076100726fd9b8448e8 /util/generic/intrlist_ut.cpp | |
parent | 6cffcf9a14a1dd07278bd534c7cca706ec2827b3 (diff) | |
download | ydb-df35d89845ad252e6db1c6adf84da9b15de0e3b3.tar.gz |
Restoring authorship annotation for <khlebnikov@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'util/generic/intrlist_ut.cpp')
-rw-r--r-- | util/generic/intrlist_ut.cpp | 60 |
1 files changed, 30 insertions, 30 deletions
diff --git a/util/generic/intrlist_ut.cpp b/util/generic/intrlist_ut.cpp index 27baadd582..eff7cdf2ee 100644 --- a/util/generic/intrlist_ut.cpp +++ b/util/generic/intrlist_ut.cpp @@ -20,7 +20,7 @@ class TListTest: public TTestBase { UNIT_TEST(TestListWithAutoDeleteMoveCtor); UNIT_TEST(TestListWithAutoDeleteMoveOpEq); UNIT_TEST(TestListWithAutoDeleteClear); - UNIT_TEST(TestSecondTag); + UNIT_TEST(TestSecondTag); UNIT_TEST_SUITE_END(); private: @@ -38,7 +38,7 @@ private: void TestListWithAutoDeleteMoveCtor(); void TestListWithAutoDeleteMoveOpEq(); void TestListWithAutoDeleteClear(); - void TestSecondTag(); + void TestSecondTag(); }; UNIT_TEST_SUITE_REGISTRATION(TListTest); @@ -475,38 +475,38 @@ void TListTest::TestListWithAutoDeleteClear() { UNIT_ASSERT_EQUAL(counter, 0); } - + struct TSecondTag {}; - -class TDoubleNode + +class TDoubleNode : public TInt, public TIntrusiveListItem<TDoubleNode, TSecondTag> { -public: +public: TDoubleNode(int value) noexcept : TInt(value) { } -}; - -void TListTest::TestSecondTag() { - TDoubleNode zero(0), one(1); - TIntrusiveList<TInt> first; - TIntrusiveList<TDoubleNode, TSecondTag> second; - - first.PushFront(&zero); - first.PushFront(&one); - second.PushBack(&zero); - second.PushBack(&one); - - UNIT_ASSERT_EQUAL(*first.Front(), 1); - UNIT_ASSERT_EQUAL(*++first.Begin(), 0); - UNIT_ASSERT_EQUAL(*first.Back(), 0); - - UNIT_ASSERT_EQUAL(*second.Front(), 0); - UNIT_ASSERT_EQUAL(*++second.Begin(), 1); - UNIT_ASSERT_EQUAL(*second.Back(), 1); - - second.Remove(&zero); - UNIT_ASSERT_EQUAL(*second.Front(), 1); - UNIT_ASSERT_EQUAL(*first.Back(), 0); -} +}; + +void TListTest::TestSecondTag() { + TDoubleNode zero(0), one(1); + TIntrusiveList<TInt> first; + TIntrusiveList<TDoubleNode, TSecondTag> second; + + first.PushFront(&zero); + first.PushFront(&one); + second.PushBack(&zero); + second.PushBack(&one); + + UNIT_ASSERT_EQUAL(*first.Front(), 1); + UNIT_ASSERT_EQUAL(*++first.Begin(), 0); + UNIT_ASSERT_EQUAL(*first.Back(), 0); + + UNIT_ASSERT_EQUAL(*second.Front(), 0); + UNIT_ASSERT_EQUAL(*++second.Begin(), 1); + UNIT_ASSERT_EQUAL(*second.Back(), 1); + + second.Remove(&zero); + UNIT_ASSERT_EQUAL(*second.Front(), 1); + UNIT_ASSERT_EQUAL(*first.Back(), 0); +} |