]> git.ozlabs.org Git - ccan/blobdiff - ccan/htable/test/run.c
htable: add a htable_prev method to oppose _next
[ccan] / ccan / htable / test / run.c
index c5272c151df43686fbae208004d2a51ed951875c..09cde890f7ea34af2e8be9c080ebd472c2b8f21c 100644 (file)
@@ -105,7 +105,7 @@ int main(int argc, char *argv[])
        void *p;
        struct htable_iter iter;
 
-       plan_tests(35);
+       plan_tests(36);
        for (i = 0; i < NUM_VALS; i++)
                val[i] = i;
        dne = i;
@@ -156,6 +156,11 @@ int main(int argc, char *argv[])
                i++;
        ok1(i == NUM_VALS);
 
+       i = 0;
+       for (p = htable_prev(&ht, &iter); p; p = htable_prev(&ht, &iter))
+               i++;
+       ok1(i == NUM_VALS);
+
        /* Delete all. */
        del_vals(&ht, val, NUM_VALS);
        ok1(!htable_get(&ht, hash(&val[0], NULL), objcmp, &val[0]));