From 5d7d4cdf531234390055540dc4ccc478268b0588 Mon Sep 17 00:00:00 2001 From: comex Date: Thu, 29 Jan 2015 01:48:09 -0500 Subject: get rid of the unnecessary CoreFoundation dependency --- test/test-htab.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'test/test-htab.c') diff --git a/test/test-htab.c b/test/test-htab.c index 2986de8..ad23cdb 100644 --- a/test/test-htab.c +++ b/test/test-htab.c @@ -1,6 +1,7 @@ #include "cbit/htab.h" #include #include +#include struct teststr { bool valid; const char *what; @@ -19,15 +20,23 @@ int main() { for(int i = 0; i < 100; i++) { const char *k; asprintf((char **) &k, "foo%d", i); - *htab_setp_teststr_int(hp, &k) = i; + bool new; + *htab_setp_teststr_int(hp, &k, &new) = i; + assert(new); + } + { + const char *k = "foo31"; + bool new; + htab_setp_teststr_int(hp, &k, NULL); + htab_setp_teststr_int(hp, &k, &new); + assert(!new); + htab_remove_teststr_int(hp, &k); } - const char *to_remove = "foo31"; - htab_remove_teststr_int(hp, &to_remove); HTAB_FOREACH(hp, const char **k, int *v, teststr_int) { if(*v % 10 == 1) printf("%s -> %d\n", *k, *v); } - htab_free_teststr_int(hp); + htab_free_storage_teststr_int(hp); } /* -- cgit v1.2.3