X-Git-Url: http://git.ozlabs.org/?p=ccan;a=blobdiff_plain;f=ccan%2Fstrmap%2Ftest%2Frun.c;h=aaa8618125c14d228a0a08da695aff8bd4c7e708;hp=34302846f120f873aa856e2c08f750c48af5745d;hb=56023cca5f66a40646a1e807c3d10af6e5913623;hpb=ed1b25bbd01f79b5b333fd28b53455d2c91b831f diff --git a/ccan/strmap/test/run.c b/ccan/strmap/test/run.c index 34302846..aaa86181 100644 --- a/ccan/strmap/test/run.c +++ b/ccan/strmap/test/run.c @@ -14,20 +14,25 @@ int main(void) char *v; /* This is how many tests you plan to run */ - plan_tests(32); + plan_tests(42); strmap_init(&map); ok1(!strmap_get(&map, str)); + ok1(errno == ENOENT); ok1(!strmap_get(&map, none)); + ok1(errno == ENOENT); ok1(!strmap_del(&map, str, NULL)); + ok1(errno == ENOENT); ok1(!strmap_del(&map, none, NULL)); + ok1(errno == ENOENT); ok1(strmap_add(&map, str, val)); ok1(strmap_get(&map, str) == val); /* We compare the string, not the pointer. */ ok1(strmap_get(&map, dup) == val); ok1(!strmap_get(&map, none)); + ok1(errno == ENOENT); /* Add a duplicate should fail. */ ok1(!strmap_add(&map, dup, val)); @@ -38,18 +43,23 @@ int main(void) ok1(strmap_del(&map, dup, &v) == str); ok1(v == val); ok1(!strmap_get(&map, str)); + ok1(errno == ENOENT); ok1(!strmap_get(&map, none)); + ok1(errno == ENOENT); /* Try insert and delete of empty string. */ ok1(strmap_add(&map, none, none)); ok1(strmap_get(&map, none) == none); ok1(!strmap_get(&map, str)); + ok1(errno == ENOENT); /* Delete should return original string. */ ok1(strmap_del(&map, "", &v) == none); ok1(v == none); ok1(!strmap_get(&map, str)); + ok1(errno == ENOENT); ok1(!strmap_get(&map, none)); + ok1(errno == ENOENT); /* Both at once... */ ok1(strmap_add(&map, none, none));