]> git.ozlabs.org Git - ccan/blobdiff - ccan/strgrp/test/api_iterate_two_groups.c
strgrp: new module
[ccan] / ccan / strgrp / test / api_iterate_two_groups.c
diff --git a/ccan/strgrp/test/api_iterate_two_groups.c b/ccan/strgrp/test/api_iterate_two_groups.c
new file mode 100644 (file)
index 0000000..ebf81a5
--- /dev/null
@@ -0,0 +1,18 @@
+#include "../test/helpers.h"
+
+int main(void) {
+    struct strgrp *ctx;
+    struct strgrp_iter *iter;
+
+    plan_tests(3);
+    create(ctx, DEFAULT_SIMILARITY);
+    strgrp_add(ctx, "a", NULL);
+    strgrp_add(ctx, "b", NULL);
+    iter = strgrp_iter_new(ctx);
+    ok1(strgrp_iter_next(iter));
+    ok1(strgrp_iter_next(iter));
+    ok1(!strgrp_iter_next(iter));
+    strgrp_iter_free(iter);
+    strgrp_free(ctx);
+    return exit_status();
+}