test/test_list.c

changeset 497
b182a8b8a1af
parent 496
1a07e24801a9
child 498
435c9965b2dd
equal deleted inserted replaced
496:1a07e24801a9 497:b182a8b8a1af
760 } 760 }
761 761
762 void test_hl_linked_list_iterator_impl(CxList list) { 762 void test_hl_linked_list_iterator_impl(CxList list) {
763 int i = 0; 763 int i = 0;
764 CxIterator iter = cxListBegin(list); 764 CxIterator iter = cxListBegin(list);
765 cx_foreach(int, x, iter) { 765 cx_foreach(int*, x, iter) {
766 CU_ASSERT_EQUAL(iter.index, (size_t) (i + 1) / 2) 766 CU_ASSERT_EQUAL(iter.index, (size_t) (i + 1) / 2)
767 CU_ASSERT_EQUAL(*x, i) 767 CU_ASSERT_EQUAL(*x, i)
768 if (i % 2 == 1) iter.remove = true; 768 if (*x % 2 == 1) iter.remove = true;
769 i++; 769 i++;
770 } 770 }
771 CU_ASSERT_EQUAL(i, 10) 771 CU_ASSERT_EQUAL(i, 10)
772 CU_ASSERT_EQUAL_FATAL(list->size, 5) 772 CU_ASSERT_EQUAL_FATAL(list->size, 5)
773 CU_ASSERT_EQUAL(*(int *) cxListAt(list, 0), 0) 773 CU_ASSERT_EQUAL(*(int *) cxListAt(list, 0), 0)

mercurial