struct parent parent;
struct child c1, c2, c3, *c, *n;
unsigned int i;
+ struct list_head list = LIST_HEAD_INIT(list);
- plan_tests(47);
- /* Test LIST_HEAD, list_empty and check_list */
+ plan_tests(49);
+ /* Test LIST_HEAD, LIST_HEAD_INIT, list_empty and check_list */
ok1(list_empty(&static_list));
ok1(list_check(&static_list, NULL));
+ ok1(list_empty(&list));
+ ok1(list_check(&list, NULL));
parent.num_children = 0;
list_head_init(&parent.children);
}
ok1(i == 3);
- /* Test list_for_each_safe and list_del. */
+ /* Test list_for_each_safe, list_del and list_del_from. */
i = 0;
list_for_each_safe(&parent.children, c, n, list) {
switch (i++) {
case 0:
- ok1(c == &c1);
+ ok1(c == &c1);
+ list_del(&c->list);
break;
case 1:
ok1(c == &c2);
+ list_del_from(&parent.children, &c->list);
break;
case 2:
ok1(c == &c3);
+ list_del_from(&parent.children, &c->list);
break;
}
- list_del(&c->list);
ok1(list_check(&parent.children, NULL));
if (i > 2)
break;