setset: fix API to match strmap and common sense.
[ccan] / ccan / strset / test / run.c
index 412a1fdfb1b1532ccb41e03569bee8feff5c0cc7..a84172d9e1f942e11f2ac289aeb0e4d7b86fb3fd 100644 (file)
@@ -14,53 +14,53 @@ int main(void)
 
        strset_init(&set);
 
-       ok1(!strset_test(&set, str));
+       ok1(!strset_get(&set, str));
        ok1(errno == ENOENT);
-       ok1(!strset_test(&set, none));
+       ok1(!strset_get(&set, none));
        ok1(errno == ENOENT);
-       ok1(!strset_clear(&set, str));
+       ok1(!strset_del(&set, str));
        ok1(errno == ENOENT);
-       ok1(!strset_clear(&set, none));
+       ok1(!strset_del(&set, none));
        ok1(errno == ENOENT);
 
-       ok1(strset_set(&set, str));
-       ok1(strset_test(&set, str));
+       ok1(strset_add(&set, str));
+       ok1(strset_get(&set, str));
        /* We compare the string, not the pointer. */
-       ok1(strset_test(&set, dup));
-       ok1(!strset_test(&set, none));
+       ok1(strset_get(&set, dup));
+       ok1(!strset_get(&set, none));
        ok1(errno == ENOENT);
 
        /* Add of duplicate should fail. */
-       ok1(!strset_set(&set, dup));
+       ok1(!strset_add(&set, dup));
        ok1(errno == EEXIST);
 
        /* Delete should return original string. */
-       ok1(strset_clear(&set, dup) == str);
-       ok1(!strset_test(&set, str));
+       ok1(strset_del(&set, dup) == str);
+       ok1(!strset_get(&set, str));
        ok1(errno == ENOENT);
-       ok1(!strset_test(&set, none));
+       ok1(!strset_get(&set, none));
        ok1(errno == ENOENT);
 
        /* Try insert and delete of empty string. */
-       ok1(strset_set(&set, none));
-       ok1(strset_test(&set, none));
-       ok1(!strset_test(&set, str));
+       ok1(strset_add(&set, none));
+       ok1(strset_get(&set, none));
+       ok1(!strset_get(&set, str));
        ok1(errno == ENOENT);
 
        /* Delete should return original string. */
-       ok1(strset_clear(&set, "") == none);
-       ok1(!strset_test(&set, str));
+       ok1(strset_del(&set, "") == none);
+       ok1(!strset_get(&set, str));
        ok1(errno == ENOENT);
-       ok1(!strset_test(&set, none));
+       ok1(!strset_get(&set, none));
        ok1(errno == ENOENT);
 
        /* Both at once... */
-       ok1(strset_set(&set, none));
-       ok1(strset_set(&set, str));
-       ok1(strset_test(&set, str));
-       ok1(strset_test(&set, none));
-       ok1(strset_clear(&set, "") == none);
-       ok1(strset_clear(&set, dup) == str);
+       ok1(strset_add(&set, none));
+       ok1(strset_add(&set, str));
+       ok1(strset_get(&set, str));
+       ok1(strset_get(&set, none));
+       ok1(strset_del(&set, "") == none);
+       ok1(strset_del(&set, dup) == str);
 
        ok1(set.u.n == NULL);
        free(dup);