test/test_list.c

changeset 478
599770bb6314
parent 476
60ff4561dc04
child 479
a29bdd703e02
equal deleted inserted replaced
477:73a93c7a56ae 478:599770bb6314
223 CU_ASSERT_PTR_NULL(nodes[1].prev) 223 CU_ASSERT_PTR_NULL(nodes[1].prev)
224 CU_ASSERT_PTR_NULL(nodes[0].prev) 224 CU_ASSERT_PTR_NULL(nodes[0].prev)
225 } 225 }
226 226
227 void test_linked_list_first(void) { 227 void test_linked_list_first(void) {
228 CU_ASSERT_PTR_NULL(cx_linked_list_first(NULL, 0))
229
230 struct node { 228 struct node {
231 int data; 229 int data;
232 void *prev; 230 void *prev;
233 }; 231 };
234 ptrdiff_t loc = offsetof(struct node, prev); 232 ptrdiff_t loc = offsetof(struct node, prev);
241 CU_ASSERT_PTR_EQUAL(cx_linked_list_first(&second, loc), &first) 239 CU_ASSERT_PTR_EQUAL(cx_linked_list_first(&second, loc), &first)
242 CU_ASSERT_PTR_EQUAL(cx_linked_list_first(&third, loc), &first) 240 CU_ASSERT_PTR_EQUAL(cx_linked_list_first(&third, loc), &first)
243 } 241 }
244 242
245 void test_linked_list_last(void) { 243 void test_linked_list_last(void) {
246 CU_ASSERT_PTR_NULL(cx_linked_list_last(NULL, 0))
247
248 struct node { 244 struct node {
249 int data; 245 int data;
250 void *next; 246 void *next;
251 }; 247 };
252 ptrdiff_t loc = offsetof(struct node, next); 248 ptrdiff_t loc = offsetof(struct node, next);

mercurial