test/test_map.cpp

changeset 630
ac5e7f789048
parent 604
056e5f592d84
equal deleted inserted replaced
629:6c81ee4f11ad 630:ac5e7f789048
181 cxMapPut(map, cx_hash_key_str("key 3"), (void *) "val 3"); 181 cxMapPut(map, cx_hash_key_str("key 3"), (void *) "val 3");
182 cxMapPut(map, cx_hash_key_str("key 4"), (void *) "val 4"); 182 cxMapPut(map, cx_hash_key_str("key 4"), (void *) "val 4");
183 cxMapPut(map, cx_hash_key_str("key 5"), (void *) "val 5"); 183 cxMapPut(map, cx_hash_key_str("key 5"), (void *) "val 5");
184 cxMapPut(map, cx_hash_key_str("key 6"), (void *) "val 6"); 184 cxMapPut(map, cx_hash_key_str("key 6"), (void *) "val 6");
185 185
186 auto iter = cxMapIterator(map); 186 auto iter = cxMapMutIterator(map);
187 cx_foreach(CxMapEntry*, entry, iter) { 187 cx_foreach(CxMapEntry*, entry, iter) {
188 if (entry->key->data.cstr[4] % 2 == 1) iter.remove = true; 188 if (entry->key->data.cstr[4] % 2 == 1) cxIteratorFlagRemoval(iter);
189 } 189 }
190 EXPECT_EQ(map->size, 3); 190 EXPECT_EQ(map->size, 3);
191 EXPECT_EQ(iter.index, map->size); 191 EXPECT_EQ(iter.index, map->size);
192 192
193 EXPECT_EQ(cxMapGet(map, cx_hash_key_str("key 1")), nullptr); 193 EXPECT_EQ(cxMapGet(map, cx_hash_key_str("key 1")), nullptr);

mercurial