diff options
author | Andrey Fomichev <andrey.fomichev@gmail.com> | 2022-02-10 16:49:12 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:49:12 +0300 |
commit | e542cc14db4240643a06bb0dde87ecf361f101ab (patch) | |
tree | 3b03a4b94acd11a4eca042532035806e5fa08ad1 /library/cpp/containers/intrusive_avl_tree/ut/avltree_ut.cpp | |
parent | e2ac73225f30f7fcf7df3cb225cba257f56144c1 (diff) | |
download | ydb-e542cc14db4240643a06bb0dde87ecf361f101ab.tar.gz |
Restoring authorship annotation for Andrey Fomichev <andrey.fomichev@gmail.com>. Commit 1 of 2.
Diffstat (limited to 'library/cpp/containers/intrusive_avl_tree/ut/avltree_ut.cpp')
-rw-r--r-- | library/cpp/containers/intrusive_avl_tree/ut/avltree_ut.cpp | 78 |
1 files changed, 39 insertions, 39 deletions
diff --git a/library/cpp/containers/intrusive_avl_tree/ut/avltree_ut.cpp b/library/cpp/containers/intrusive_avl_tree/ut/avltree_ut.cpp index cab2365cce..bb258ac078 100644 --- a/library/cpp/containers/intrusive_avl_tree/ut/avltree_ut.cpp +++ b/library/cpp/containers/intrusive_avl_tree/ut/avltree_ut.cpp @@ -1,66 +1,66 @@ #include <library/cpp/testing/unittest/registar.h> - + #include <library/cpp/containers/intrusive_avl_tree/avltree.h> - -class TAvlTreeTest: public TTestBase { + +class TAvlTreeTest: public TTestBase { UNIT_TEST_SUITE(TAvlTreeTest); UNIT_TEST(TestLowerBound); UNIT_TEST(TestIterator); UNIT_TEST_SUITE_END(); - + private: void TestLowerBound(); void TestIterator(); - + class TIt; struct TItCompare { static inline bool Compare(const TIt& l, const TIt& r) noexcept; }; - + class TIt: public TAvlTreeItem<TIt, TItCompare> { public: TIt(int val = 0) : Val(val) { } - + int Val; }; - + using TIts = TAvlTree<TIt, TItCompare>; -}; - +}; + inline bool TAvlTreeTest::TItCompare::Compare(const TIt& l, const TIt& r) noexcept { - return l.Val < r.Val; -} - -UNIT_TEST_SUITE_REGISTRATION(TAvlTreeTest); - -void TAvlTreeTest::TestLowerBound() { - TIts its; - TIt it1(5); - TIt it2(2); - TIt it3(10); - TIt it4(879); - TIt it5(1); - TIt it6(52); - TIt it7(4); - TIt it8(5); - its.Insert(&it1); - its.Insert(&it2); - its.Insert(&it3); - its.Insert(&it4); - its.Insert(&it5); - its.Insert(&it6); - its.Insert(&it7); - its.Insert(&it8); - - TIt it_zero(0); - TIt it_large(1000); - UNIT_ASSERT_EQUAL(its.LowerBound(&it3), &it3); - UNIT_ASSERT_EQUAL(its.LowerBound(&it_zero), &it5); + return l.Val < r.Val; +} + +UNIT_TEST_SUITE_REGISTRATION(TAvlTreeTest); + +void TAvlTreeTest::TestLowerBound() { + TIts its; + TIt it1(5); + TIt it2(2); + TIt it3(10); + TIt it4(879); + TIt it5(1); + TIt it6(52); + TIt it7(4); + TIt it8(5); + its.Insert(&it1); + its.Insert(&it2); + its.Insert(&it3); + its.Insert(&it4); + its.Insert(&it5); + its.Insert(&it6); + its.Insert(&it7); + its.Insert(&it8); + + TIt it_zero(0); + TIt it_large(1000); + UNIT_ASSERT_EQUAL(its.LowerBound(&it3), &it3); + UNIT_ASSERT_EQUAL(its.LowerBound(&it_zero), &it5); UNIT_ASSERT_EQUAL(its.LowerBound(&it_large), nullptr); -} +} void TAvlTreeTest::TestIterator() { TIts its; |