test/dlist_tests.c

changeset 71
303dabadff1c
parent 69
fb59270b1de3
child 89
47f7fdbddb62
     1.1 --- a/test/dlist_tests.c	Fri Oct 12 10:54:55 2012 +0200
     1.2 +++ b/test/dlist_tests.c	Fri Oct 12 12:08:34 2012 +0200
     1.3 @@ -5,13 +5,13 @@
     1.4  #include "dlist_tests.h"
     1.5  
     1.6  UCX_TEST_IMPLEMENT(test_ucx_dlist_append) {
     1.7 -    UcxDlist *list = ucx_dlist_append(NULL, "Hello");
     1.8 +    UcxDlist *list = ucx_dlist_append(NULL, (void*)"Hello");
     1.9      UCX_TEST_BEGIN
    1.10      
    1.11      UCX_TEST_ASSERT(strncmp((const char*)list->data, "Hello", 5) == 0,
    1.12              "failed");
    1.13      
    1.14 -    list = ucx_dlist_append(list, " World!");
    1.15 +    list = ucx_dlist_append(list, (void*)" World!");
    1.16      
    1.17      UCX_TEST_ASSERT(strncmp((const char*)list->next->data, " World!", 7) == 0,
    1.18              "failed");
    1.19 @@ -22,10 +22,10 @@
    1.20  }
    1.21  
    1.22  UCX_TEST_IMPLEMENT(test_ucx_dlist_prepend) {
    1.23 -    UcxDlist *list = ucx_dlist_prepend(NULL, " World!");
    1.24 +    UcxDlist *list = ucx_dlist_prepend(NULL, (void*)" World!");
    1.25      UCX_TEST_BEGIN
    1.26  
    1.27 -    list = ucx_dlist_prepend(list, "Hello");
    1.28 +    list = ucx_dlist_prepend(list, (void*)"Hello");
    1.29      
    1.30      UCX_TEST_ASSERT(strncmp((const char*)list->data, "Hello", 5) == 0,
    1.31              "failed");
    1.32 @@ -38,12 +38,12 @@
    1.33  }
    1.34  
    1.35  UCX_TEST_IMPLEMENT(test_ucx_dlist_equals) {
    1.36 -    UcxDlist *list = ucx_dlist_append(NULL, "Hello");
    1.37 -    list = ucx_dlist_append(list, " World!");
    1.38 -    UcxDlist *list2 = ucx_dlist_prepend(NULL, " World!");
    1.39 -    list2 = ucx_dlist_prepend(list2, "Hello");
    1.40 -    UcxDlist *list3 = ucx_dlist_prepend(NULL, " Welt!");
    1.41 -    list3 = ucx_dlist_prepend(list3, "Hallo");
    1.42 +    UcxDlist *list = ucx_dlist_append(NULL, (void*)"Hello");
    1.43 +    list = ucx_dlist_append(list, (void*)" World!");
    1.44 +    UcxDlist *list2 = ucx_dlist_prepend(NULL, (void*)" World!");
    1.45 +    list2 = ucx_dlist_prepend(list2, (void*)"Hello");
    1.46 +    UcxDlist *list3 = ucx_dlist_prepend(NULL, (void*)" Welt!");
    1.47 +    list3 = ucx_dlist_prepend(list3, (void*)"Hallo");
    1.48      UCX_TEST_BEGIN
    1.49      
    1.50      UCX_TEST_ASSERT(ucx_dlist_equals(list, list2, cmp_string, NULL), "failed");
    1.51 @@ -56,8 +56,8 @@
    1.52  }
    1.53  
    1.54  UCX_TEST_IMPLEMENT(test_ucx_dlist_concat) {
    1.55 -    UcxDlist *list = ucx_dlist_append(NULL, "Hello");
    1.56 -    UcxDlist *list2 = ucx_dlist_prepend(NULL, " World!");
    1.57 +    UcxDlist *list = ucx_dlist_append(NULL, (void*)"Hello");
    1.58 +    UcxDlist *list2 = ucx_dlist_prepend(NULL, (void*)" World!");
    1.59      UCX_TEST_BEGIN
    1.60      
    1.61      list = ucx_dlist_concat(list, list2);
    1.62 @@ -73,12 +73,12 @@
    1.63  }
    1.64  
    1.65  UCX_TEST_IMPLEMENT(test_ucx_dlist_size) {
    1.66 -    UcxDlist *list = ucx_dlist_append(NULL, "This ");
    1.67 +    UcxDlist *list = ucx_dlist_append(NULL, (void*)"This ");
    1.68      UCX_TEST_BEGIN
    1.69 -    list = ucx_dlist_append(list, "list ");
    1.70 -    list = ucx_dlist_append(list, "has ");
    1.71 -    list = ucx_dlist_append(list, "size ");
    1.72 -    list = ucx_dlist_append(list, "5!");
    1.73 +    list = ucx_dlist_append(list, (void*)"list ");
    1.74 +    list = ucx_dlist_append(list, (void*)"has ");
    1.75 +    list = ucx_dlist_append(list, (void*)"size ");
    1.76 +    list = ucx_dlist_append(list, (void*)"5!");
    1.77      
    1.78      UCX_TEST_ASSERT(ucx_dlist_size(list) == 5, "failed");
    1.79      
    1.80 @@ -87,10 +87,10 @@
    1.81  }
    1.82  
    1.83  UCX_TEST_IMPLEMENT(test_ucx_dlist_first) {
    1.84 -    UcxDlist *list = ucx_dlist_append(NULL, "Find ");
    1.85 +    UcxDlist *list = ucx_dlist_append(NULL, (void*)"Find ");
    1.86      UCX_TEST_BEGIN
    1.87 -    list = ucx_dlist_append(list, "the ");
    1.88 -    list = ucx_dlist_append(list, "first!");
    1.89 +    list = ucx_dlist_append(list, (void*)"the ");
    1.90 +    list = ucx_dlist_append(list, (void*)"first!");
    1.91      
    1.92      const char* first = (const char*) (ucx_dlist_first(list)->data);
    1.93      
    1.94 @@ -101,10 +101,10 @@
    1.95  }
    1.96  
    1.97  UCX_TEST_IMPLEMENT(test_ucx_dlist_last) {
    1.98 -    UcxDlist *list = ucx_dlist_append(NULL, "Find ");
    1.99 +    UcxDlist *list = ucx_dlist_append(NULL, (void*)"Find ");
   1.100      UCX_TEST_BEGIN
   1.101 -    list = ucx_dlist_append(list, "the ");
   1.102 -    list = ucx_dlist_append(list, "last!");
   1.103 +    list = ucx_dlist_append(list, (void*)"the ");
   1.104 +    list = ucx_dlist_append(list, (void*)"last!");
   1.105      
   1.106      const char* last = (const char*) (ucx_dlist_last(list)->data);
   1.107      
   1.108 @@ -115,10 +115,10 @@
   1.109  }
   1.110  
   1.111  UCX_TEST_IMPLEMENT(test_ucx_dlist_get) {
   1.112 -    UcxDlist *list = ucx_dlist_append(NULL, "Find ");
   1.113 +    UcxDlist *list = ucx_dlist_append(NULL, (void*)"Find ");
   1.114      UCX_TEST_BEGIN
   1.115 -    list = ucx_dlist_append(list, "the ");
   1.116 -    list = ucx_dlist_append(list, "mid!");
   1.117 +    list = ucx_dlist_append(list, (void*)"the ");
   1.118 +    list = ucx_dlist_append(list, (void*)"mid!");
   1.119      
   1.120      const char* mid = (const char*) (ucx_dlist_get(list, 1)->data);
   1.121      
   1.122 @@ -129,10 +129,10 @@
   1.123  }
   1.124  
   1.125  UCX_TEST_IMPLEMENT(test_ucx_dlist_remove) {
   1.126 -    UcxDlist *list = ucx_dlist_append(NULL, "Hello");
   1.127 +    UcxDlist *list = ucx_dlist_append(NULL, (void*)"Hello");
   1.128      UCX_TEST_BEGIN
   1.129 -    list = ucx_dlist_append(list, " fucking");
   1.130 -    list = ucx_dlist_append(list, " World!");
   1.131 +    list = ucx_dlist_append(list, (void*)" fucking");
   1.132 +    list = ucx_dlist_append(list, (void*)" World!");
   1.133      
   1.134      list = ucx_dlist_remove(list, ucx_dlist_get(list, 1));
   1.135      
   1.136 @@ -175,21 +175,21 @@
   1.137  }
   1.138  
   1.139  UCX_TEST_IMPLEMENT(test_ucx_dlist_sort) {
   1.140 -    UcxDlist *list = ucx_dlist_append(NULL, "this");
   1.141 -    list = ucx_dlist_append(list, "is");
   1.142 -    list = ucx_dlist_append(list, "a");
   1.143 -    list = ucx_dlist_append(list, "test");
   1.144 -    list = ucx_dlist_append(list, "for");
   1.145 -    list = ucx_dlist_append(list, "partial");
   1.146 -    list = ucx_dlist_append(list, "correctness");
   1.147 +    UcxDlist *list = ucx_dlist_append(NULL, (void*)"this");
   1.148 +    list = ucx_dlist_append(list, (void*)"is");
   1.149 +    list = ucx_dlist_append(list, (void*)"a");
   1.150 +    list = ucx_dlist_append(list, (void*)"test");
   1.151 +    list = ucx_dlist_append(list, (void*)"for");
   1.152 +    list = ucx_dlist_append(list, (void*)"partial");
   1.153 +    list = ucx_dlist_append(list, (void*)"correctness");
   1.154  
   1.155 -    UcxDlist *expected = ucx_dlist_append(NULL, "a");
   1.156 -    expected = ucx_dlist_append(expected, "correctness");
   1.157 -    expected = ucx_dlist_append(expected, "for");
   1.158 -    expected = ucx_dlist_append(expected, "is");
   1.159 -    expected = ucx_dlist_append(expected, "partial");
   1.160 -    expected = ucx_dlist_append(expected, "test");
   1.161 -    expected = ucx_dlist_append(expected, "this");
   1.162 +    UcxDlist *expected = ucx_dlist_append(NULL, (void*)"a");
   1.163 +    expected = ucx_dlist_append(expected, (void*)"correctness");
   1.164 +    expected = ucx_dlist_append(expected, (void*)"for");
   1.165 +    expected = ucx_dlist_append(expected, (void*)"is");
   1.166 +    expected = ucx_dlist_append(expected, (void*)"partial");
   1.167 +    expected = ucx_dlist_append(expected, (void*)"test");
   1.168 +    expected = ucx_dlist_append(expected, (void*)"this");
   1.169  
   1.170      list = ucx_dlist_sort(list, cmp_string, NULL);
   1.171  

mercurial