+
+ /* Test list_add_before and list_add_after */
+ list_add(&parent.children, &c1.list);
+ list_add_after(&parent.children, &c1.list, &c2.list);
+ ok1(list_check(&parent.children, "list_add_after"));
+
+ i = 0;
+ list_for_each(&parent.children, c, list) {
+ switch (i++) {
+ case 0:
+ ok1(c == &c1);
+ break;
+ case 1:
+ ok1(c == &c2);
+ break;
+ }
+ }
+ ok1(i == 2);
+
+ list_add_before(&parent.children, &c2.list, &c3.list);
+ ok1(list_check(&parent.children, "list_add_before"));
+
+ i = 0;
+ list_for_each(&parent.children, c, list) {
+ switch (i++) {
+ case 0:
+ ok1(c == &c1);
+ break;
+ case 1:
+ ok1(c == &c3);
+ break;
+ case 2:
+ ok1(c == &c2);
+ break;
+ }
+ }
+ ok1(i == 3);
+