From b78d6c9dd794a6cec4be3d422504633d8d12f371 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Fri, 11 Nov 2022 09:52:58 +0100 Subject: [PATCH] test/util/TestIntrusiveList: add tests for reverse iterators --- test/util/TestIntrusiveList.cxx | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/test/util/TestIntrusiveList.cxx b/test/util/TestIntrusiveList.cxx index e8c144e11..0adc765a3 100644 --- a/test/util/TestIntrusiveList.cxx +++ b/test/util/TestIntrusiveList.cxx @@ -54,6 +54,20 @@ TEST(IntrusiveList, Basic) ASSERT_EQ(&*i, &c); ++i; 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(); @@ -63,6 +77,18 @@ TEST(IntrusiveList, Basic) ASSERT_EQ(&*i, &c); ++i; 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)