test/list_tests.c

changeset 22
76cdd8209f1f
parent 19
cdd7a3173249
child 24
e04822101291
equal deleted inserted replaced
21:d599fefc7620 22:76cdd8209f1f
117 } 117 }
118 ucx_dlist_free(dl2); 118 ucx_dlist_free(dl2);
119 119
120 printf(" TODO: test clone with copy\n"); 120 printf(" TODO: test clone with copy\n");
121 121
122 ucx_dlist_free(dl);
123
124 dl = NULL;
125 printf(" Test ucx_dlist_remove\n");
126 dl = ucx_dlist_append(dl, &v[4]);
127 dl = ucx_dlist_append(dl, &v[0]);
128 dl = ucx_dlist_append(dl, &v[3]);
129 dl = ucx_dlist_remove(dl, dl->next);
130 if (ucx_dlist_size(dl) == 2) {
131 if ((*((int*)(dl->data)) != 4) || (*((int*)(dl->next->data)) != 3)) {
132 fprintf(stderr, "ucx_dlist_remove failed (wrong data)\n");
133 r--;
134 }
135 } else {
136 fprintf(stderr, "ucx_dlist_remove failed (wrong size)\n");
137 r--;
138 }
139 dl = ucx_dlist_remove(dl, dl);
140 if (ucx_dlist_size(dl) == 1) {
141 if ((*((int*)(dl->data)) != 3)) {
142 fprintf(stderr, "ucx_dlist_remove first failed (wrong data)\n");
143 r--;
144 }
145 } else {
146 fprintf(stderr, "ucx_dlist_remove first failed (wrong size)\n");
147 r--;
148 }
149
122 return r; 150 return r;
123 } 151 }
124 152

mercurial