aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoriofik <iofik@yandex-team.ru>2022-02-10 16:52:07 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:52:07 +0300
commitb58d341b41ab1a4a61f0ff7f13737d95afa6c469 (patch)
treec462f5ec59eb7de92f9e46fc9b7ce663997fc6b5
parent9920e18b25b64503bb2bf01f23bfa899383a5a34 (diff)
downloadydb-b58d341b41ab1a4a61f0ff7f13737d95afa6c469.tar.gz
Restoring authorship annotation for <iofik@yandex-team.ru>. Commit 1 of 2.
-rw-r--r--util/generic/intrlist.h12
-rw-r--r--util/generic/intrlist_ut.cpp188
2 files changed, 100 insertions, 100 deletions
diff --git a/util/generic/intrlist.h b/util/generic/intrlist.h
index b5d3f2051b..2d18365d81 100644
--- a/util/generic/intrlist.h
+++ b/util/generic/intrlist.h
@@ -521,7 +521,7 @@ public:
gapFront->SetNext(gapBack);
gapBack->SetPrev(gapFront);
-
+
TListItem* const pasteBack = pasteBefore.Item();
TListItem* const pasteFront = pasteBack->Prev();
@@ -541,11 +541,11 @@ public:
functor(&*(i++));
}
}
-
+
template <class TFunctor>
inline void ForEach(TFunctor&& functor) const {
TConstIterator i = Begin();
-
+
while (i != End()) {
functor(&*(i++));
}
@@ -589,13 +589,13 @@ class TIntrusiveListWithAutoDelete: public TIntrusiveList<T, Tag> {
public:
using TIterator = typename TIntrusiveList<T, Tag>::TIterator;
using TConstIterator = typename TIntrusiveList<T, Tag>::TConstIterator;
-
+
using TReverseIterator = typename TIntrusiveList<T, Tag>::TReverseIterator;
using TConstReverseIterator = typename TIntrusiveList<T, Tag>::TConstReverseIterator;
using iterator = TIterator;
using const_iterator = TConstIterator;
-
+
using reverse_iterator = TReverseIterator;
using const_reverse_iterator = TConstReverseIterator;
@@ -622,7 +622,7 @@ public:
D::Destroy(item);
});
}
-
+
inline static void Cut(TIterator begin, TIterator end) noexcept {
TIntrusiveListWithAutoDelete<T, D, Tag> temp;
Cut(begin, end, temp.End());
diff --git a/util/generic/intrlist_ut.cpp b/util/generic/intrlist_ut.cpp
index eff7cdf2ee..9e34137f45 100644
--- a/util/generic/intrlist_ut.cpp
+++ b/util/generic/intrlist_ut.cpp
@@ -200,107 +200,107 @@ void TListTest::TestForEachWithDelete() {
UNIT_ASSERT_EQUAL(sum, 500 * 500 /*== n * (x + y * (n - 1) / 2), x == 1, y == 2*/);
}
-
-static void CheckIterationAfterCut(const TMyList& l, const TMyList& l2, size_t N, size_t M) {
- size_t c = 0;
- for (TMyList::TConstIterator it = l.Begin(); it != l.End(); ++it) {
- ++c;
-
- UNIT_ASSERT_EQUAL(*it, (int)c);
- }
-
- UNIT_ASSERT_EQUAL(c, M);
-
- for (TMyList::TConstIterator it = l2.Begin(); it != l2.End(); ++it) {
- ++c;
-
- UNIT_ASSERT_EQUAL(*it, (int)c);
- }
-
- UNIT_ASSERT_EQUAL(c, N);
-
- for (TMyList::TConstIterator it = l2.End(); it != l2.Begin(); --c) {
- --it;
-
- UNIT_ASSERT_EQUAL(*it, (int)c);
- }
-
- UNIT_ASSERT_EQUAL(c, M);
-
- for (TMyList::TConstIterator it = l.End(); it != l.Begin(); --c) {
- --it;
-
- UNIT_ASSERT_EQUAL(*it, (int)c);
- }
-
- UNIT_ASSERT_EQUAL(c, 0);
-}
-
+
+static void CheckIterationAfterCut(const TMyList& l, const TMyList& l2, size_t N, size_t M) {
+ size_t c = 0;
+ for (TMyList::TConstIterator it = l.Begin(); it != l.End(); ++it) {
+ ++c;
+
+ UNIT_ASSERT_EQUAL(*it, (int)c);
+ }
+
+ UNIT_ASSERT_EQUAL(c, M);
+
+ for (TMyList::TConstIterator it = l2.Begin(); it != l2.End(); ++it) {
+ ++c;
+
+ UNIT_ASSERT_EQUAL(*it, (int)c);
+ }
+
+ UNIT_ASSERT_EQUAL(c, N);
+
+ for (TMyList::TConstIterator it = l2.End(); it != l2.Begin(); --c) {
+ --it;
+
+ UNIT_ASSERT_EQUAL(*it, (int)c);
+ }
+
+ UNIT_ASSERT_EQUAL(c, M);
+
+ for (TMyList::TConstIterator it = l.End(); it != l.Begin(); --c) {
+ --it;
+
+ UNIT_ASSERT_EQUAL(*it, (int)c);
+ }
+
+ UNIT_ASSERT_EQUAL(c, 0);
+}
+
static void TestCutFront(int N, int M) {
- TMyList l(N);
- TMyList l2(0);
-
- TMyList::TIterator it = l.Begin();
+ TMyList l(N);
+ TMyList l2(0);
+
+ TMyList::TIterator it = l.Begin();
for (int i = 0; i < M; ++i) {
- ++it;
- }
-
- TMyList::Cut(l.Begin(), it, l2.End());
+ ++it;
+ }
+
+ TMyList::Cut(l.Begin(), it, l2.End());
CheckIterationAfterCut(l2, l, N, M);
-}
-
+}
+
static void TestCutBack(int N, int M) {
- TMyList l(N);
- TMyList l2(0);
-
- TMyList::TIterator it = l.Begin();
+ TMyList l(N);
+ TMyList l2(0);
+
+ TMyList::TIterator it = l.Begin();
for (int i = 0; i < M; ++i) {
- ++it;
- }
-
- TMyList::Cut(it, l.End(), l2.End());
+ ++it;
+ }
+
+ TMyList::Cut(it, l.End(), l2.End());
CheckIterationAfterCut(l, l2, N, M);
-}
-
-void TListTest::TestCut() {
- TestCutFront(1000, 500);
- TestCutBack(1000, 500);
- TestCutFront(1, 0);
- TestCutBack(1, 0);
- TestCutFront(1, 1);
- TestCutBack(1, 1);
- TestCutFront(2, 0);
- TestCutBack(2, 0);
- TestCutFront(2, 1);
- TestCutBack(2, 1);
- TestCutFront(2, 2);
- TestCutBack(2, 2);
-}
-
-static void CheckIterationAfterAppend(const TMyList& l, size_t N, size_t M) {
- TMyList::TConstIterator it = l.Begin();
-
- for (size_t i = 1; i <= N; ++i, ++it) {
- UNIT_ASSERT_EQUAL((int)i, *it);
- }
-
- for (size_t i = 1; i <= M; ++i, ++it) {
- UNIT_ASSERT_EQUAL((int)i, *it);
- }
-
- UNIT_ASSERT_EQUAL(it, l.End());
-}
-
+}
+
+void TListTest::TestCut() {
+ TestCutFront(1000, 500);
+ TestCutBack(1000, 500);
+ TestCutFront(1, 0);
+ TestCutBack(1, 0);
+ TestCutFront(1, 1);
+ TestCutBack(1, 1);
+ TestCutFront(2, 0);
+ TestCutBack(2, 0);
+ TestCutFront(2, 1);
+ TestCutBack(2, 1);
+ TestCutFront(2, 2);
+ TestCutBack(2, 2);
+}
+
+static void CheckIterationAfterAppend(const TMyList& l, size_t N, size_t M) {
+ TMyList::TConstIterator it = l.Begin();
+
+ for (size_t i = 1; i <= N; ++i, ++it) {
+ UNIT_ASSERT_EQUAL((int)i, *it);
+ }
+
+ for (size_t i = 1; i <= M; ++i, ++it) {
+ UNIT_ASSERT_EQUAL((int)i, *it);
+ }
+
+ UNIT_ASSERT_EQUAL(it, l.End());
+}
+
static void TestAppend(int N, int M) {
- TMyList l(N);
- TMyList l2(M);
- l.Append(l2);
-
- UNIT_ASSERT(l2.Empty());
- CheckIterationAfterAppend(l, N, M);
-}
-
-void TListTest::TestAppend() {
+ TMyList l(N);
+ TMyList l2(M);
+ l.Append(l2);
+
+ UNIT_ASSERT(l2.Empty());
+ CheckIterationAfterAppend(l, N, M);
+}
+
+void TListTest::TestAppend() {
::TestAppend(500, 500);
::TestAppend(0, 0);
::TestAppend(1, 0);