test/list_tests.c

changeset 71
303dabadff1c
parent 69
fb59270b1de3
child 89
47f7fdbddb62
     1.1 --- a/test/list_tests.c	Fri Oct 12 10:54:55 2012 +0200
     1.2 +++ b/test/list_tests.c	Fri Oct 12 12:08:34 2012 +0200
     1.3 @@ -5,12 +5,12 @@
     1.4  #include "list_tests.h"
     1.5  
     1.6  UCX_TEST_IMPLEMENT(test_ucx_list_append) {
     1.7 -    UcxList *list = ucx_list_append(NULL, "Hello");
     1.8 +    UcxList *list = ucx_list_append(NULL, (void*)"Hello");
     1.9      UCX_TEST_BEGIN
    1.10      UCX_TEST_ASSERT(strncmp((const char*)list->data, "Hello", 5) == 0,
    1.11              "failed");
    1.12      
    1.13 -    list = ucx_list_append(list, " World!");
    1.14 +    list = ucx_list_append(list, (void*)" World!");
    1.15      
    1.16      UCX_TEST_ASSERT(strncmp((const char*)list->next->data, " World!", 7) == 0,
    1.17              "failed");
    1.18 @@ -21,9 +21,9 @@
    1.19  }
    1.20  
    1.21  UCX_TEST_IMPLEMENT(test_ucx_list_prepend) {
    1.22 -    UcxList *list = ucx_list_prepend(NULL, " World!");
    1.23 +    UcxList *list = ucx_list_prepend(NULL, (void*)" World!");
    1.24      UCX_TEST_BEGIN
    1.25 -    list = ucx_list_prepend(list, "Hello");
    1.26 +    list = ucx_list_prepend(list, (void*)"Hello");
    1.27      
    1.28      UCX_TEST_ASSERT(strncmp((const char*)list->data, "Hello", 5) == 0,
    1.29              "failed");
    1.30 @@ -36,12 +36,12 @@
    1.31  }
    1.32  
    1.33  UCX_TEST_IMPLEMENT(test_ucx_list_equals) {
    1.34 -    UcxList *list = ucx_list_append(NULL, "Hello");
    1.35 -    list = ucx_list_append(list, " World!");
    1.36 -    UcxList *list2 = ucx_list_prepend(NULL, " World!");
    1.37 -    list2 = ucx_list_prepend(list2, "Hello");
    1.38 -    UcxList *list3 = ucx_list_prepend(NULL, " Welt!");
    1.39 -    list3 = ucx_list_prepend(list3, "Hallo");
    1.40 +    UcxList *list = ucx_list_append(NULL, (void*)"Hello");
    1.41 +    list = ucx_list_append(list, (void*)" World!");
    1.42 +    UcxList *list2 = ucx_list_prepend(NULL, (void*)" World!");
    1.43 +    list2 = ucx_list_prepend(list2, (void*)"Hello");
    1.44 +    UcxList *list3 = ucx_list_prepend(NULL, (void*)" Welt!");
    1.45 +    list3 = ucx_list_prepend(list3, (void*)"Hallo");
    1.46      
    1.47      UCX_TEST_BEGIN
    1.48      UCX_TEST_ASSERT(ucx_list_equals(list, list2, cmp_string, NULL), "failed");
    1.49 @@ -54,8 +54,8 @@
    1.50  }
    1.51  
    1.52  UCX_TEST_IMPLEMENT(test_ucx_list_concat) {
    1.53 -    UcxList *list = ucx_list_append(NULL, "Hello");
    1.54 -    UcxList *list2 = ucx_list_prepend(NULL, " World!");
    1.55 +    UcxList *list = ucx_list_append(NULL, (void*)"Hello");
    1.56 +    UcxList *list2 = ucx_list_prepend(NULL, (void*)" World!");
    1.57      
    1.58      list = ucx_list_concat(list, list2);
    1.59      UCX_TEST_BEGIN
    1.60 @@ -74,12 +74,12 @@
    1.61  }
    1.62  
    1.63  UCX_TEST_IMPLEMENT(test_ucx_list_size) {
    1.64 -    UcxList *list = ucx_list_append(NULL, "This ");
    1.65 +    UcxList *list = ucx_list_append(NULL, (void*)"This ");
    1.66      UCX_TEST_BEGIN
    1.67 -    list = ucx_list_append(list, "list ");
    1.68 -    list = ucx_list_append(list, "has ");
    1.69 -    list = ucx_list_append(list, "size ");
    1.70 -    list = ucx_list_append(list, "5!");
    1.71 +    list = ucx_list_append(list, (void*)"list ");
    1.72 +    list = ucx_list_append(list, (void*)"has ");
    1.73 +    list = ucx_list_append(list, (void*)"size ");
    1.74 +    list = ucx_list_append(list, (void*)"5!");
    1.75      
    1.76      UCX_TEST_ASSERT(ucx_list_size(list) == 5, "failed");
    1.77      
    1.78 @@ -88,10 +88,10 @@
    1.79  }
    1.80  
    1.81  UCX_TEST_IMPLEMENT(test_ucx_list_last) {
    1.82 -    UcxList *list = ucx_list_append(NULL, "Find ");
    1.83 +    UcxList *list = ucx_list_append(NULL, (void*)"Find ");
    1.84      UCX_TEST_BEGIN
    1.85 -    list = ucx_list_append(list, "the ");
    1.86 -    list = ucx_list_append(list, "last!");
    1.87 +    list = ucx_list_append(list, (void*)"the ");
    1.88 +    list = ucx_list_append(list, (void*)"last!");
    1.89      
    1.90      const char* last = (const char*) (ucx_list_last(list)->data);
    1.91      
    1.92 @@ -103,10 +103,10 @@
    1.93  }
    1.94  
    1.95  UCX_TEST_IMPLEMENT(test_ucx_list_get) {
    1.96 -    UcxList *list = ucx_list_append(NULL, "Find ");
    1.97 +    UcxList *list = ucx_list_append(NULL, (void*)"Find ");
    1.98      UCX_TEST_BEGIN
    1.99 -    list = ucx_list_append(list, "the ");
   1.100 -    list = ucx_list_append(list, "mid!");
   1.101 +    list = ucx_list_append(list, (void*)"the ");
   1.102 +    list = ucx_list_append(list, (void*)"mid!");
   1.103      
   1.104      const char* mid = (const char*) (ucx_list_get(list, 1)->data);
   1.105      
   1.106 @@ -117,10 +117,10 @@
   1.107  }
   1.108  
   1.109  UCX_TEST_IMPLEMENT(test_ucx_list_remove) {
   1.110 -    UcxList *list = ucx_list_append(NULL, "Hello");
   1.111 +    UcxList *list = ucx_list_append(NULL, (void*)"Hello");
   1.112      UCX_TEST_BEGIN
   1.113 -    list = ucx_list_append(list, " fucking");
   1.114 -    list = ucx_list_append(list, " World!");
   1.115 +    list = ucx_list_append(list, (void*)" fucking");
   1.116 +    list = ucx_list_append(list, (void*)" World!");
   1.117      
   1.118      list = ucx_list_remove(list, ucx_list_get(list, 1));
   1.119      
   1.120 @@ -163,21 +163,21 @@
   1.121  }
   1.122  
   1.123  UCX_TEST_IMPLEMENT(test_ucx_list_sort) {
   1.124 -    UcxList *list = ucx_list_append(NULL, "this");
   1.125 -    list = ucx_list_append(list, "is");
   1.126 -    list = ucx_list_append(list, "a");
   1.127 -    list = ucx_list_append(list, "test");
   1.128 -    list = ucx_list_append(list, "for");
   1.129 -    list = ucx_list_append(list, "partial");
   1.130 -    list = ucx_list_append(list, "correctness");
   1.131 +    UcxList *list = ucx_list_append(NULL, (void*)"this");
   1.132 +    list = ucx_list_append(list, (void*)"is");
   1.133 +    list = ucx_list_append(list, (void*)"a");
   1.134 +    list = ucx_list_append(list, (void*)"test");
   1.135 +    list = ucx_list_append(list, (void*)"for");
   1.136 +    list = ucx_list_append(list, (void*)"partial");
   1.137 +    list = ucx_list_append(list, (void*)"correctness");
   1.138  
   1.139 -    UcxList *expected = ucx_list_append(NULL, "a");
   1.140 -    expected = ucx_list_append(expected, "correctness");
   1.141 -    expected = ucx_list_append(expected, "for");
   1.142 -    expected = ucx_list_append(expected, "is");
   1.143 -    expected = ucx_list_append(expected, "partial");
   1.144 -    expected = ucx_list_append(expected, "test");
   1.145 -    expected = ucx_list_append(expected, "this");
   1.146 +    UcxList *expected = ucx_list_append(NULL, (void*)"a");
   1.147 +    expected = ucx_list_append(expected, (void*)"correctness");
   1.148 +    expected = ucx_list_append(expected, (void*)"for");
   1.149 +    expected = ucx_list_append(expected, (void*)"is");
   1.150 +    expected = ucx_list_append(expected, (void*)"partial");
   1.151 +    expected = ucx_list_append(expected, (void*)"test");
   1.152 +    expected = ucx_list_append(expected, (void*)"this");
   1.153  
   1.154      list = ucx_list_sort(list, cmp_string, NULL);
   1.155  

mercurial