test/util/TestIntrusiveList: add tests for reverse iterators

This commit is contained in:
Max Kellermann 2022-11-11 09:52:58 +01:00
parent b5d224496f
commit b78d6c9dd7

View File

@ -54,6 +54,20 @@ TEST(IntrusiveList, Basic)
ASSERT_EQ(&*i, &c); ASSERT_EQ(&*i, &c);
++i; ++i;
ASSERT_EQ(i, list.end()); ASSERT_EQ(i, list.end());
++i;
ASSERT_EQ(&*i, &a);
--i;
ASSERT_EQ(i, list.end());
--i;
ASSERT_EQ(&*i, &c);
--i;
ASSERT_EQ(&*i, &b);
--i;
ASSERT_EQ(&*i, &a);
ASSERT_EQ(i, list.begin());
--i;
ASSERT_EQ(i, list.end());
b.unlink(); b.unlink();
@ -63,6 +77,18 @@ TEST(IntrusiveList, Basic)
ASSERT_EQ(&*i, &c); ASSERT_EQ(&*i, &c);
++i; ++i;
ASSERT_EQ(i, list.end()); ASSERT_EQ(i, list.end());
++i;
ASSERT_EQ(&*i, &a);
--i;
ASSERT_EQ(i, list.end());
--i;
ASSERT_EQ(&*i, &c);
--i;
ASSERT_EQ(&*i, &a);
ASSERT_EQ(i, list.begin());
--i;
ASSERT_EQ(i, list.end());
} }
TEST(IntrusiveList, SafeLink) TEST(IntrusiveList, SafeLink)