test/list_tests.c

changeset 22
76cdd8209f1f
parent 19
cdd7a3173249
child 24
e04822101291
     1.1 --- a/test/list_tests.c	Sat Jan 14 13:07:18 2012 +0100
     1.2 +++ b/test/list_tests.c	Sun Jan 15 14:12:34 2012 +0100
     1.3 @@ -119,6 +119,34 @@
     1.4      
     1.5      printf("   TODO: test clone with copy\n");
     1.6  
     1.7 +    ucx_dlist_free(dl);
     1.8 +
     1.9 +    dl = NULL;
    1.10 +    printf("   Test ucx_dlist_remove\n");
    1.11 +    dl = ucx_dlist_append(dl, &v[4]);
    1.12 +    dl = ucx_dlist_append(dl, &v[0]);
    1.13 +    dl = ucx_dlist_append(dl, &v[3]);
    1.14 +    dl = ucx_dlist_remove(dl, dl->next);
    1.15 +    if (ucx_dlist_size(dl) == 2) {
    1.16 +        if ((*((int*)(dl->data)) != 4) || (*((int*)(dl->next->data)) != 3)) {
    1.17 +            fprintf(stderr, "ucx_dlist_remove failed (wrong data)\n");
    1.18 +            r--;
    1.19 +        }
    1.20 +    } else {
    1.21 +        fprintf(stderr, "ucx_dlist_remove failed (wrong size)\n");
    1.22 +        r--;
    1.23 +    }
    1.24 +    dl = ucx_dlist_remove(dl, dl);
    1.25 +    if (ucx_dlist_size(dl) == 1) {
    1.26 +        if ((*((int*)(dl->data)) != 3)) {
    1.27 +            fprintf(stderr, "ucx_dlist_remove first failed (wrong data)\n");
    1.28 +            r--;
    1.29 +        }
    1.30 +    } else {
    1.31 +        fprintf(stderr, "ucx_dlist_remove first failed (wrong size)\n");
    1.32 +        r--;
    1.33 +    }
    1.34 +
    1.35      return r;
    1.36  }
    1.37  

mercurial