aboutsummaryrefslogtreecommitdiffstats
path: root/util/generic/intrlist_ut.cpp
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 /util/generic/intrlist_ut.cpp
parent9920e18b25b64503bb2bf01f23bfa899383a5a34 (diff)
downloadydb-b58d341b41ab1a4a61f0ff7f13737d95afa6c469.tar.gz
Restoring authorship annotation for <iofik@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'util/generic/intrlist_ut.cpp')
-rw-r--r--util/generic/intrlist_ut.cpp188
1 files changed, 94 insertions, 94 deletions
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);