test/util/TestIntrusiveForwardList: add push_back() test

This commit is contained in:
Max Kellermann 2023-10-04 12:33:06 +02:00 committed by Max Kellermann
parent 5aaa3f50aa
commit 5ddddbb16f

View File

@ -133,6 +133,26 @@ TEST(IntrusiveForwardList, CacheLast)
list.reverse(); list.reverse();
ASSERT_EQ(ToString(list), ""); ASSERT_EQ(ToString(list), "");
/* test push_back() */
for (auto &i : items)
list.push_back(i);
ASSERT_EQ(ToString(list), "abc");
ASSERT_EQ(&list.back(), &items[2]);
list.clear();
/* test push_back() again to see if clear() has worked */
for (auto &i : items)
list.push_back(i);
ASSERT_EQ(ToString(list), "abc");
ASSERT_EQ(&list.back(), &items[2]);
list.clear();
for (auto &i : items) for (auto &i : items)
list.push_front(i); list.push_front(i);