summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2011-12-01 14:12:11 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2011-12-06 18:15:14 +1000
commitc8e451a8e719ba432bcfa8976774c07307087809 (patch)
tree678b0e45593684c896aec455a748d5b53c59c6df /test
parent6acebf9e1298939593b942ec91ae9ec9e74faa19 (diff)
include: add list_last_entry to get the tail of a list
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
Diffstat (limited to 'test')
-rw-r--r--test/list.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/test/list.c b/test/list.c
index b96182e03..ffb85efd0 100644
--- a/test/list.c
+++ b/test/list.c
@@ -103,14 +103,20 @@ test_list_append(void)
c = list_first_entry(&parent.children, struct child, node);
assert(memcmp(c, &child[0], sizeof(struct child)) == 0);
+ c = list_last_entry(&parent.children, struct child, node);
+ assert(memcmp(c, &child[0], sizeof(struct child)) == 0);
list_append(&child[1].node, &parent.children);
c = list_first_entry(&parent.children, struct child, node);
assert(memcmp(c, &child[0], sizeof(struct child)) == 0);
+ c = list_last_entry(&parent.children, struct child, node);
+ assert(memcmp(c, &child[1], sizeof(struct child)) == 0);
list_append(&child[2].node, &parent.children);
c = list_first_entry(&parent.children, struct child, node);
assert(memcmp(c, &child[0], sizeof(struct child)) == 0);
+ c = list_last_entry(&parent.children, struct child, node);
+ assert(memcmp(c, &child[2], sizeof(struct child)) == 0);
i = 0;
list_for_each_entry(c, &parent.children, node) {