test/list_tests.c

changeset 69
fb59270b1de3
parent 40
583718dd4cf3
child 71
303dabadff1c
--- a/test/list_tests.c	Thu Oct 11 16:29:30 2012 +0200
+++ b/test/list_tests.c	Fri Oct 12 10:54:55 2012 +0200
@@ -7,11 +7,13 @@
 UCX_TEST_IMPLEMENT(test_ucx_list_append) {
     UcxList *list = ucx_list_append(NULL, "Hello");
     UCX_TEST_BEGIN
-    UCX_TEST_ASSERT(strncmp(list->data, "Hello", 5) == 0, "failed");
+    UCX_TEST_ASSERT(strncmp((const char*)list->data, "Hello", 5) == 0,
+            "failed");
     
     list = ucx_list_append(list, " World!");
     
-    UCX_TEST_ASSERT(strncmp(list->next->data, " World!", 7) == 0, "failed");
+    UCX_TEST_ASSERT(strncmp((const char*)list->next->data, " World!", 7) == 0,
+            "failed");
     UCX_TEST_ASSERT(list->next->next == NULL, "failed");
 
     UCX_TEST_END
@@ -23,8 +25,10 @@
     UCX_TEST_BEGIN
     list = ucx_list_prepend(list, "Hello");
     
-    UCX_TEST_ASSERT(strncmp(list->data, "Hello", 5) == 0, "failed");
-    UCX_TEST_ASSERT(strncmp(list->next->data, " World!", 7) == 0, "failed");
+    UCX_TEST_ASSERT(strncmp((const char*)list->data, "Hello", 5) == 0,
+            "failed");
+    UCX_TEST_ASSERT(strncmp((const char*)list->next->data, " World!", 7) == 0,
+            "failed");
     UCX_TEST_ASSERT(list->next->next == NULL, "failed");
     
     UCX_TEST_END
@@ -56,8 +60,10 @@
     list = ucx_list_concat(list, list2);
     UCX_TEST_BEGIN
     
-    UCX_TEST_ASSERT(strncmp(list->data, "Hello", 5) == 0, "failed");
-    UCX_TEST_ASSERT(strncmp(list->next->data, " World!", 7) == 0, "failed");
+    UCX_TEST_ASSERT(strncmp((const char*)list->data, "Hello", 5) == 0,
+            "failed");
+    UCX_TEST_ASSERT(strncmp((const char*)list->next->data, " World!", 7) == 0,
+            "failed");
     UCX_TEST_ASSERT(list->next->next == NULL, "failed");
     
     UCX_TEST_END
@@ -87,7 +93,7 @@
     list = ucx_list_append(list, "the ");
     list = ucx_list_append(list, "last!");
     
-    char* last = (char*) (ucx_list_last(list)->data);
+    const char* last = (const char*) (ucx_list_last(list)->data);
     
     UCX_TEST_ASSERT(strncmp(last, "last!", 5) == 0, "failed");
     
@@ -102,7 +108,7 @@
     list = ucx_list_append(list, "the ");
     list = ucx_list_append(list, "mid!");
     
-    char* mid = (char*) (ucx_list_get(list, 1)->data);
+    const char* mid = (const char*) (ucx_list_get(list, 1)->data);
     
     UCX_TEST_ASSERT(strncmp(mid, "the ", 4) == 0, "failed");
     
@@ -118,8 +124,10 @@
     
     list = ucx_list_remove(list, ucx_list_get(list, 1));
     
-    UCX_TEST_ASSERT(strncmp(list->data, "Hello", 5) == 0, "failed");
-    UCX_TEST_ASSERT(strncmp(list->next->data, " World!", 7) == 0, "failed");
+    UCX_TEST_ASSERT(strncmp((const char*)list->data, "Hello", 5) == 0,
+            "failed");
+    UCX_TEST_ASSERT(strncmp((const char*)list->next->data, " World!", 7) == 0,
+            "failed");
     UCX_TEST_ASSERT(list->next->next == NULL, "failed");
     UCX_TEST_END
     

mercurial