test/list_tests.c

changeset 35
fdabd1240b69
parent 33
9c219a62070d
child 36
a9d656e4f7ce
     1.1 --- a/test/list_tests.c	Fri Jun 01 12:35:30 2012 +0200
     1.2 +++ b/test/list_tests.c	Wed Aug 15 19:32:29 2012 +0200
     1.3 @@ -153,3 +153,31 @@
     1.4      ucx_list_free(list);
     1.5      ucx_list_free(copy);
     1.6  }
     1.7 +
     1.8 +UCX_TEST_IMPLEMENT(test_ucx_list_qsort) {
     1.9 +    UcxList *list = ucx_list_append(NULL, "this");
    1.10 +    list = ucx_list_append(list, "is");
    1.11 +    list = ucx_list_append(list, "a");
    1.12 +    list = ucx_list_append(list, "test");
    1.13 +    list = ucx_list_append(list, "for");
    1.14 +    list = ucx_list_append(list, "partial");
    1.15 +    list = ucx_list_append(list, "correctness");
    1.16 +
    1.17 +    UcxList *expected = ucx_list_append(NULL, "a");
    1.18 +    expected = ucx_list_append(expected, "correctness");
    1.19 +    expected = ucx_list_append(expected, "for");
    1.20 +    expected = ucx_list_append(expected, "is");
    1.21 +    expected = ucx_list_append(expected, "partial");
    1.22 +    expected = ucx_list_append(expected, "test");
    1.23 +    expected = ucx_list_append(expected, "this");
    1.24 +
    1.25 +    list = ucx_list_qsort(list, cmp_string, NULL);
    1.26 +
    1.27 +    UCX_TEST_BEGIN
    1.28 +    UCX_TEST_ASSERT(
    1.29 +            ucx_list_equals(list, expected, cmp_string, NULL), "failed");
    1.30 +    UCX_TEST_END
    1.31 +
    1.32 +    ucx_list_free(expected);
    1.33 +    ucx_list_free(list);
    1.34 +}

mercurial