test/util/TestIntrusiveForwardList: add push_back() test
This commit is contained in:
parent
5aaa3f50aa
commit
5ddddbb16f
@ -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);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user