]> git.ozlabs.org Git - ccan/blobdiff - ccan/htable/test/run-type.c
base64: fix for unsigned chars (e.g. ARM).
[ccan] / ccan / htable / test / run-type.c
index f097acb69fdec375acb8472fdc0034a452cd05ca..c4201ed0cc5f5a6b151603f015ece212d5484d9a 100644 (file)
@@ -65,7 +65,7 @@ static void find_vals(const struct htable_obj *ht,
                        return;
                }
        }
-       pass("Found %u numbers in hash", i);
+       ok1(htable_obj_count(ht) == i);
 }
 
 static void del_vals(struct htable_obj *ht,
@@ -116,17 +116,19 @@ int main(void)
        void *p;
        struct htable_obj_iter iter;
 
-       plan_tests(29);
+       plan_tests(35);
        for (i = 0; i < NUM_VALS; i++)
                val[i].key = i;
        dne = i;
 
        htable_obj_init(&ht);
+       ok1(htable_obj_count(&ht) == 0);
        ok1(ht_max(&ht.raw) == 0);
        ok1(ht.raw.bits == 0);
 
        /* We cannot find an entry which doesn't exist. */
        ok1(!htable_obj_get(&ht, &dne));
+       ok1(!htable_obj_pick(&ht, 0, NULL));
 
        /* Fill it, it should increase in size. */
        add_vals(&ht, val, NUM_VALS);
@@ -141,6 +143,8 @@ int main(void)
        /* Find all. */
        find_vals(&ht, val, NUM_VALS);
        ok1(!htable_obj_get(&ht, &dne));
+       ok1(htable_obj_pick(&ht, 0, NULL));
+       ok1(htable_obj_pick(&ht, 0, &iter));
 
        /* Walk once, should get them all. */
        i = 0;
@@ -205,6 +209,8 @@ int main(void)
        }
 
        htable_obj_clear(&ht);
+       ok1(htable_obj_count(&ht) == 0);
        htable_obj_clear(&ht2);
+       ok1(htable_obj_count(&ht2) == 0);
        return exit_status();
 }