summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 07e184c)
raw | patch | inline | side by side (parent: 07e184c)
author | Sebastian Harl <sh@tokkee.org> | |
Wed, 27 May 2015 20:48:21 +0000 (22:48 +0200) | ||
committer | Sebastian Harl <sh@tokkee.org> | |
Wed, 27 May 2015 20:48:21 +0000 (22:48 +0200) |
t/unit/core/store_test.c | patch | blob | history |
index ed6f5d9b149944e31c4412c4c6103dd9a9f25320..6d528dede366fe9bce639e9e6eb10eba4cb7a268 100644 (file)
--- a/t/unit/core/store_test.c
+++ b/t/unit/core/store_test.c
struct {
const char *name;
- _Bool has;
+ bool have;
} golden_hosts[] = {
{ "a", 1 == 1 },
{ "b", 1 == 1 },
}
for (i = 0; i < SDB_STATIC_ARRAY_LEN(golden_hosts); ++i) {
- _Bool has;
-
- has = sdb_store_has_host(golden_hosts[i].name);
- fail_unless(has == golden_hosts[i].has,
- "sdb_store_has_host(%s) = %d; expected: %d",
- golden_hosts[i].name, has, golden_hosts[i].has);
+ sdb_store_obj_t *have;
+
+ have = sdb_store_get_host(golden_hosts[i].name);
+ fail_unless((have != NULL) == golden_hosts[i].have,
+ "sdb_store_get_host(%s) = %p; expected: %s",
+ golden_hosts[i].name, have,
+ golden_hosts[i].have ? "<host>" : "NULL");
+ sdb_object_deref(SDB_OBJ(have));
}
}
END_TEST
sdb_store_obj_t *sobj1, *sobj2;
int ref_cnt;
- fail_unless(sdb_store_has_host(golden_hosts[i]),
- "sdb_store_has_host(%s) = FALSE; expected: TRUE",
- golden_hosts[i]);
-
sobj1 = sdb_store_get_host(golden_hosts[i]);
fail_unless(sobj1 != NULL,
"sdb_store_get_host(%s) = NULL; expected: <host>",
for (i = 0; i < SDB_STATIC_ARRAY_LEN(unknown_hosts); ++i) {
sdb_store_obj_t *sobj;
- fail_unless(!sdb_store_has_host(unknown_hosts[i]),
- "sdb_store_has_host(%s) = TRUE; expected: FALSE",
- unknown_hosts[i]);
-
sobj = sdb_store_get_host(unknown_hosts[i]);
fail_unless(!sobj, "sdb_store_get_host(%s) = <host:%s>; expected: NULL",
unknown_hosts[i], sobj ? SDB_OBJ(sobj)->name : "NULL");