tests/test_hash_map.c

changeset 1115
6db21dee4929
parent 1114
ad5eeb256242
--- a/tests/test_hash_map.c	Tue Jan 07 19:16:03 2025 +0100
+++ b/tests/test_hash_map.c	Wed Jan 08 20:06:37 2025 +0100
@@ -209,7 +209,7 @@
 
         // iterate
         bool s3found = false, s4found = false, s5found = false;
-        CxIterator iter = cxMapIteratorValues(map);
+        CxMapIterator iter = cxMapIteratorValues(map);
         cx_foreach(cxstring*, s, iter) {
             s3found |= s3.ptr == s->ptr;
             s4found |= s4.ptr == s->ptr;
@@ -237,7 +237,7 @@
         cxMapPut(map, "key 5", (void *) "val 5");
         cxMapPut(map, "key 6", (void *) "val 6");
 
-        CxIterator iter = cxMapMutIterator(map);
+        CxMapIterator iter = cxMapMutIterator(map);
         cx_foreach(CxMapEntry*, entry, iter) {
             if (((const char *)entry->key->data)[4] % 2 == 1) cxIteratorFlagRemoval(iter);
         }
@@ -338,13 +338,13 @@
     // now remove k1 via key iterator and k5 (val 5) via value iterator
     v1[0] = 'y'; // mark v1 and check that destr is not called for previous val
     {
-        CxIterator iter = cxMapMutIteratorKeys(map);
+        CxMapIterator iter = cxMapMutIteratorKeys(map);
         cx_foreach(CxHashKey*, key, iter) {
             if (((char*)key->data)[4] == '1') cxIteratorFlagRemoval(iter);
         }
     }
     {
-        CxIterator iter = cxMapMutIteratorValues(map);
+        CxMapIterator iter = cxMapMutIteratorValues(map);
         cx_foreach(struct test_destr_struct*, v, iter) {
             if (v->str[4] == '5') cxIteratorFlagRemoval(iter);
         }
@@ -437,12 +437,12 @@
 CX_TEST(test_empty_map_iterator) {
     CxMap *map = cxEmptyMap;
 
-    CxIterator it1 = cxMapIterator(map);
-    CxIterator it2 = cxMapIteratorValues(map);
-    CxIterator it3 = cxMapIteratorKeys(map);
-    CxIterator it4 = cxMapMutIterator(map);
-    CxIterator it5 = cxMapMutIteratorValues(map);
-    CxIterator it6 = cxMapMutIteratorKeys(map);
+    CxMapIterator it1 = cxMapIterator(map);
+    CxMapIterator it2 = cxMapIteratorValues(map);
+    CxMapIterator it3 = cxMapIteratorKeys(map);
+    CxMapIterator it4 = cxMapMutIterator(map);
+    CxMapIterator it5 = cxMapMutIteratorValues(map);
+    CxMapIterator it6 = cxMapMutIteratorKeys(map);
 
     CX_TEST_DO {
         CX_TEST_ASSERT(!cxIteratorValid(it1));
@@ -607,7 +607,7 @@
     // verify key iterator
     {
         // collect the keys from the map iterator
-        CxIterator keyiter = cxMapIteratorKeys(map);
+        CxMapIterator keyiter = cxMapIteratorKeys(map);
         CX_TEST_ASSERT(keyiter.elem_size == sizeof(CxHashKey));
         CX_TEST_ASSERT(keyiter.elem_count == map->collection.size);
         CxHashKey *keys = calloc(map->collection.size, sizeof(CxHashKey));
@@ -628,7 +628,7 @@
     {
         // by using that the values in our test data are unique strings
         // we can re-use a similar approach as above
-        CxIterator valiter = cxMapIteratorValues(map);
+        CxMapIterator valiter = cxMapIteratorValues(map);
         CX_TEST_ASSERT(valiter.elem_size == map->collection.elem_size);
         CX_TEST_ASSERT(valiter.elem_count == map->collection.size);
         const char ** values = calloc(map->collection.size, sizeof(const char *));
@@ -652,7 +652,7 @@
 
     // verify pair iterator
     {
-        CxIterator pairiter = cxMapIterator(map);
+        CxMapIterator pairiter = cxMapIterator(map);
         CX_TEST_ASSERT(pairiter.elem_size == sizeof(CxMapEntry));
         CX_TEST_ASSERT(pairiter.elem_count == map->collection.size);
         struct test_map_kv *pairs = calloc(map->collection.size, sizeof(struct test_map_kv));

mercurial