66 |
66 |
67 UCX_TEST_END |
67 UCX_TEST_END |
68 ucx_list_free(list); |
68 ucx_list_free(list); |
69 } |
69 } |
70 |
70 |
71 UCX_TEST(test_ucx_list_append_once) { |
|
72 UcxList *list, *first; |
|
73 list = first = ucx_list_append_once(NULL, (void*)"Hello", ucx_cmp_str, NULL); |
|
74 UCX_TEST_BEGIN |
|
75 |
|
76 UCX_TEST_ASSERT(strncmp((const char*)list->data, "Hello", 5) == 0, |
|
77 "failed"); |
|
78 |
|
79 list = ucx_list_append_once(list, (void*)"Hello", ucx_cmp_str, NULL); |
|
80 list = ucx_list_append_once(list, (void*)" World!", ucx_cmp_str, NULL); |
|
81 |
|
82 UCX_TEST_ASSERT(list == first, "does not return first element"); |
|
83 UCX_TEST_ASSERT(strncmp((const char*)list->next->data, " World!", 7) == 0, |
|
84 "'Hello' was not inserted _once_"); |
|
85 UCX_TEST_ASSERT(list->next->prev == list, "failed"); |
|
86 UCX_TEST_ASSERT(list->next->next == NULL, "right not terminated"); |
|
87 UCX_TEST_END |
|
88 |
|
89 ucx_list_free(list); |
|
90 } |
|
91 |
|
92 UCX_TEST(test_ucx_list_equals) { |
71 UCX_TEST(test_ucx_list_equals) { |
93 const char *hello = "Hello"; |
72 const char *hello = "Hello"; |
94 const char *world = " World!"; |
73 const char *world = " World!"; |
95 UcxList *list = ucx_list_append(NULL, (void*)hello); |
74 UcxList *list = ucx_list_append(NULL, (void*)hello); |
96 list = ucx_list_append(list, (void*)world); |
75 list = ucx_list_append(list, (void*)world); |