test/test_list.c

changeset 496
1a07e24801a9
parent 495
2856c74e18ba
child 497
b182a8b8a1af
equal deleted inserted replaced
495:2856c74e18ba 496:1a07e24801a9
759 CU_ASSERT_TRUE(cxTestingAllocatorVerify()) 759 CU_ASSERT_TRUE(cxTestingAllocatorVerify())
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 for (CxIterator iter = cxListBegin(list); cxIteratorValid(&iter); cxIteratorNext(&iter)) { 764 CxIterator iter = cxListBegin(list);
765 cx_foreach(int, x, iter) {
765 CU_ASSERT_EQUAL(iter.index, (size_t) (i + 1) / 2) 766 CU_ASSERT_EQUAL(iter.index, (size_t) (i + 1) / 2)
766 int *x = cxIteratorCurrent(&iter);
767 CU_ASSERT_EQUAL(*x, i) 767 CU_ASSERT_EQUAL(*x, i)
768 if (i % 2 == 1) iter.remove = true; 768 if (i % 2 == 1) iter.remove = true;
769 i++; 769 i++;
770 } 770 }
771 CU_ASSERT_EQUAL(i, 10) 771 CU_ASSERT_EQUAL(i, 10)

mercurial