87 UCX_TEST_END |
87 UCX_TEST_END |
88 |
88 |
89 ucx_list_free(list); |
89 ucx_list_free(list); |
90 } |
90 } |
91 |
91 |
92 UCX_TEST(test_ucx_list_prepend_once) { |
|
93 UcxList *list, *last, *first; |
|
94 list = last = ucx_list_prepend_once(NULL, (void*)" World!", |
|
95 ucx_strcmp, NULL); |
|
96 UCX_TEST_BEGIN |
|
97 |
|
98 list = ucx_list_prepend_once(list, (void*)"Hello", ucx_strcmp, NULL); |
|
99 first = ucx_list_prepend_once(list, (void*)"Hello", ucx_strcmp, NULL); |
|
100 |
|
101 UCX_TEST_ASSERT(list == first, "'Hello' was not prepended _once_"); |
|
102 UCX_TEST_ASSERT(first == last->prev, "does not return first element"); |
|
103 UCX_TEST_ASSERT(strncmp((const char*)list->data, "Hello", 5) == 0, |
|
104 "failed"); |
|
105 UCX_TEST_ASSERT(strncmp((const char*)list->next->data, " World!", 7) == 0, |
|
106 "failed"); |
|
107 UCX_TEST_ASSERT(list->next->next == NULL, "right not terminated"); |
|
108 UCX_TEST_ASSERT(list->prev == NULL, "left not terminated"); |
|
109 |
|
110 UCX_TEST_END |
|
111 ucx_list_free(list); |
|
112 } |
|
113 |
|
114 UCX_TEST(test_ucx_list_equals) { |
92 UCX_TEST(test_ucx_list_equals) { |
115 const char *hello = "Hello"; |
93 const char *hello = "Hello"; |
116 const char *world = " World!"; |
94 const char *world = " World!"; |
117 UcxList *list = ucx_list_append(NULL, (void*)hello); |
95 UcxList *list = ucx_list_append(NULL, (void*)hello); |
118 list = ucx_list_append(list, (void*)world); |
96 list = ucx_list_append(list, (void*)world); |