delete parent;
delete link;
}
+
+TEST(ADT_DLINKED_LINK, prepend_after_append)
+{
+ auto link = new coco::PtrLink<::Child, ::Parent>{};
+ auto parent = new ::Parent{link};
+
+ auto child_1 = new ::Child{link};
+ auto child_2 = new ::Child{link};
+
+ parent->children()->append(child_1);
+ parent->children()->prepend(child_2);
+
+ ASSERT_EQ(child_2->next(), child_1);
+
+ ASSERT_EQ(child_1->parent(), parent);
+ ASSERT_EQ(child_1->prev(), child_2);
+ ASSERT_EQ(child_1->next(), nullptr);
+
+ ASSERT_EQ(parent->children()->head(), child_2);
+ ASSERT_EQ(parent->children()->tail(), child_1);
+
+ delete child_2;
+ delete child_1;
+ delete parent;
+ delete link;
+}