|
@@ -10,20 +10,25 @@ int main(void)
|
|
|
char *dup = strdup(str);
|
|
char *dup = strdup(str);
|
|
|
|
|
|
|
|
/* This is how many tests you plan to run */
|
|
/* This is how many tests you plan to run */
|
|
|
- plan_tests(26);
|
|
|
|
|
|
|
+ plan_tests(36);
|
|
|
|
|
|
|
|
strset_init(&set);
|
|
strset_init(&set);
|
|
|
|
|
|
|
|
ok1(!strset_test(&set, str));
|
|
ok1(!strset_test(&set, str));
|
|
|
|
|
+ ok1(errno == ENOENT);
|
|
|
ok1(!strset_test(&set, none));
|
|
ok1(!strset_test(&set, none));
|
|
|
|
|
+ ok1(errno == ENOENT);
|
|
|
ok1(!strset_clear(&set, str));
|
|
ok1(!strset_clear(&set, str));
|
|
|
|
|
+ ok1(errno == ENOENT);
|
|
|
ok1(!strset_clear(&set, none));
|
|
ok1(!strset_clear(&set, none));
|
|
|
|
|
+ ok1(errno == ENOENT);
|
|
|
|
|
|
|
|
ok1(strset_set(&set, str));
|
|
ok1(strset_set(&set, str));
|
|
|
ok1(strset_test(&set, str));
|
|
ok1(strset_test(&set, str));
|
|
|
/* We compare the string, not the pointer. */
|
|
/* We compare the string, not the pointer. */
|
|
|
ok1(strset_test(&set, dup));
|
|
ok1(strset_test(&set, dup));
|
|
|
ok1(!strset_test(&set, none));
|
|
ok1(!strset_test(&set, none));
|
|
|
|
|
+ ok1(errno == ENOENT);
|
|
|
|
|
|
|
|
/* Add of duplicate should fail. */
|
|
/* Add of duplicate should fail. */
|
|
|
ok1(!strset_set(&set, dup));
|
|
ok1(!strset_set(&set, dup));
|
|
@@ -32,17 +37,22 @@ int main(void)
|
|
|
/* Delete should return original string. */
|
|
/* Delete should return original string. */
|
|
|
ok1(strset_clear(&set, dup) == str);
|
|
ok1(strset_clear(&set, dup) == str);
|
|
|
ok1(!strset_test(&set, str));
|
|
ok1(!strset_test(&set, str));
|
|
|
|
|
+ ok1(errno == ENOENT);
|
|
|
ok1(!strset_test(&set, none));
|
|
ok1(!strset_test(&set, none));
|
|
|
|
|
+ ok1(errno == ENOENT);
|
|
|
|
|
|
|
|
/* Try insert and delete of empty string. */
|
|
/* Try insert and delete of empty string. */
|
|
|
ok1(strset_set(&set, none));
|
|
ok1(strset_set(&set, none));
|
|
|
ok1(strset_test(&set, none));
|
|
ok1(strset_test(&set, none));
|
|
|
ok1(!strset_test(&set, str));
|
|
ok1(!strset_test(&set, str));
|
|
|
|
|
+ ok1(errno == ENOENT);
|
|
|
|
|
|
|
|
/* Delete should return original string. */
|
|
/* Delete should return original string. */
|
|
|
ok1(strset_clear(&set, "") == none);
|
|
ok1(strset_clear(&set, "") == none);
|
|
|
ok1(!strset_test(&set, str));
|
|
ok1(!strset_test(&set, str));
|
|
|
|
|
+ ok1(errno == ENOENT);
|
|
|
ok1(!strset_test(&set, none));
|
|
ok1(!strset_test(&set, none));
|
|
|
|
|
+ ok1(errno == ENOENT);
|
|
|
|
|
|
|
|
/* Both at once... */
|
|
/* Both at once... */
|
|
|
ok1(strset_set(&set, none));
|
|
ok1(strset_set(&set, none));
|