From e251f1489df5468d3f30e5c3fd7a66aa303d5087 Mon Sep 17 00:00:00 2001 From: James Shaw Date: Sat, 22 Sep 2007 12:18:28 +0000 Subject: Implement list_contains_all() svn path=/trunk/dom/; revision=3560 --- test/list.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'test/list.c') diff --git a/test/list.c b/test/list.c index c2d098f..18b7d01 100644 --- a/test/list.c +++ b/test/list.c @@ -62,3 +62,13 @@ bool list_contains(struct list* list, void* data, int (*comparator)(const void* return false; } +bool list_contains_all(struct list* superList, struct list* subList, int (*comparator)(const void* a, const void* b)) { + struct list_elt* elt = subList->head; + while (elt != NULL) { + if (!list_contains(superList, elt->data, comparator)) { + return false; + } + elt = elt->next; + } + return true; +} -- cgit v1.2.3