summaryrefslogtreecommitdiff
path: root/test/test-list.c
diff options
context:
space:
mode:
authorBo Yang <struggleyb.nku@gmail.com>2009-08-11 11:17:23 +0000
committerBo Yang <struggleyb.nku@gmail.com>2009-08-11 11:17:23 +0000
commit399da01ae4eb5c5e3e9349bacc2063c946c3d4a1 (patch)
tree433c8bcde94fc7a6e6f2e5cbf23842a84db98146 /test/test-list.c
parenteec057c7437e19b59ca1e698ce548cb56ce37240 (diff)
downloadlibdom-399da01ae4eb5c5e3e9349bacc2063c946c3d4a1.tar.gz
libdom-399da01ae4eb5c5e3e9349bacc2063c946c3d4a1.tar.bz2
Merge the branches/struggleyb/libdom-remain back to trunk.
svn path=/trunk/dom/; revision=9191
Diffstat (limited to 'test/test-list.c')
-rw-r--r--test/test-list.c56
1 files changed, 0 insertions, 56 deletions
diff --git a/test/test-list.c b/test/test-list.c
deleted file mode 100644
index 7871286..0000000
--- a/test/test-list.c
+++ /dev/null
@@ -1,56 +0,0 @@
-#include <stdbool.h>
-#include <stdio.h>
-#include <string.h>
-
-#include "testutils.h"
-
-void test_add_remove(void);
-void test_contains_all_true(void);
-
-void test_add_remove(void)
-{
- struct list* list = list_new();
-
- char s[] = "hello";
-
- /* add element */
- list_add(list, s);
- assert(strcmp(list->head->data, "hello") == 0);
- assert(list->size == 1);
-
- /* remove element */
- bool found = list_remove(list, s);
- assert(found == true);
- assert(list->size == 0);
- assert(list->head == NULL);
-
- list_destroy(list);
-}
-
-void test_contains_all_true(void)
-{
- struct list* superList = list_new();
- struct list* subList = list_new();
-
- list_add(superList, (void*) "hello");
- list_add(superList, (void*) "world");
-
- list_add(subList, (void*) "hello");
-
- bool b = list_contains_all(superList, subList, (comparator) strcmp);
- assert(b == true);
- assert(superList->size == 2);
- assert(superList->head->next->next == NULL);
-
- list_destroy(superList);
- list_destroy(subList);
-}
-
-int main(void)
-{
- test_add_remove();
- test_contains_all_true();
- //test_different_size_lists();
-
- printf("PASS\n");
-}