summaryrefslogtreecommitdiff
path: root/test/list.c
diff options
context:
space:
mode:
authorJames Shaw <jshaw@netsurf-browser.org>2007-09-22 12:18:28 +0000
committerJames Shaw <jshaw@netsurf-browser.org>2007-09-22 12:18:28 +0000
commite251f1489df5468d3f30e5c3fd7a66aa303d5087 (patch)
treefcbdc9fb11e9ee373bb93253367d41f448444330 /test/list.c
parentd823bb50697d67e9b3f32603708fdd0299072c49 (diff)
downloadlibdom-e251f1489df5468d3f30e5c3fd7a66aa303d5087.tar.gz
libdom-e251f1489df5468d3f30e5c3fd7a66aa303d5087.tar.bz2
Implement list_contains_all()
svn path=/trunk/dom/; revision=3560
Diffstat (limited to 'test/list.c')
-rw-r--r--test/list.c10
1 files changed, 10 insertions, 0 deletions
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;
+}