diff -r 6c81ee4f11ad -r ac5e7f789048 test/test_list.cpp --- a/test/test_list.cpp Wed Nov 23 22:40:55 2022 +0100 +++ b/test/test_list.cpp Sat Nov 26 16:58:41 2022 +0100 @@ -686,11 +686,11 @@ void verifyIterator(CxList *list) const { int i = 0; - CxIterator iter = cxListBegin(list); + auto iter = cxListBeginMut(list); cx_foreach(int*, x, iter) { ASSERT_EQ(iter.index, (size_t) (i + 1) / 2); ASSERT_EQ(*x, testdata.data[i]); - if (i % 2 == 1) iter.remove = true; + if (i % 2 == 1) cxIteratorFlagRemoval(iter); i++; } auto len = testdata_len; @@ -702,31 +702,31 @@ static void verifyInsertViaIterator(CxList *list) { int newdata[] = {10, 20, 30, 40, 50}; - CxIterator iter = cxListIterator(list, 2); - EXPECT_TRUE(cxIteratorValid(&iter)); + auto iter = cxListMutIterator(list, 2); + EXPECT_TRUE(cxIteratorValid(iter)); EXPECT_EQ(iter.index, 2); - EXPECT_EQ(*(int *) cxIteratorCurrent(&iter), 2); + EXPECT_EQ(*(int *) cxIteratorCurrent(iter), 2); cxListInsertAfter(&iter, &newdata[0]); - EXPECT_TRUE(cxIteratorValid(&iter)); + EXPECT_TRUE(cxIteratorValid(iter)); EXPECT_EQ(iter.index, 2); - EXPECT_EQ(*(int *) cxIteratorCurrent(&iter), 2); + EXPECT_EQ(*(int *) cxIteratorCurrent(iter), 2); cxListInsertBefore(&iter, &newdata[1]); - EXPECT_TRUE(cxIteratorValid(&iter)); + EXPECT_TRUE(cxIteratorValid(iter)); EXPECT_EQ(iter.index, 3); - EXPECT_EQ(*(int *) cxIteratorCurrent(&iter), 2); + EXPECT_EQ(*(int *) cxIteratorCurrent(iter), 2); - iter = cxListBegin(list); + iter = cxListBeginMut(list); cxListInsertBefore(&iter, &newdata[2]); - EXPECT_TRUE(cxIteratorValid(&iter)); + EXPECT_TRUE(cxIteratorValid(iter)); EXPECT_EQ(iter.index, 1); - EXPECT_EQ(*(int *) cxIteratorCurrent(&iter), 0); - iter = cxListIterator(list, list->size); + EXPECT_EQ(*(int *) cxIteratorCurrent(iter), 0); + iter = cxListMutIterator(list, list->size); cxListInsertBefore(&iter, &newdata[3]); - EXPECT_FALSE(cxIteratorValid(&iter)); + EXPECT_FALSE(cxIteratorValid(iter)); EXPECT_EQ(iter.index, 9); - iter = cxListIterator(list, list->size); + iter = cxListMutIterator(list, list->size); cxListInsertAfter(&iter, &newdata[4]); - EXPECT_FALSE(cxIteratorValid(&iter)); + EXPECT_FALSE(cxIteratorValid(iter)); EXPECT_EQ(iter.index, 10); int expdata[] = {30, 0, 1, 20, 2, 10, 3, 4, 40, 50};