X-Git-Url: http://git.ozlabs.org/?p=ccan;a=blobdiff_plain;f=ccan%2Fhtable%2Ftest%2Frun-type.c;h=a3616a5a37b8fb1f2588d9d8e369136c6436665e;hp=51a85ff2a6f455e530e2e2245a273bc841d966d2;hb=04bcddcc084cf0ef05945c7a9d609e08e30387be;hpb=7b56762984ce66f38728b542ca347bcb6fe3e981 diff --git a/ccan/htable/test/run-type.c b/ccan/htable/test/run-type.c index 51a85ff2..a3616a5a 100644 --- a/ccan/htable/test/run-type.c +++ b/ccan/htable/test/run-type.c @@ -83,7 +83,7 @@ static void del_vals(struct htable_obj *ht, } static void del_vals_bykey(struct htable_obj *ht, - const struct obj val[], unsigned int num) + const struct obj val[] UNNEEDED, unsigned int num) { unsigned int i; @@ -107,16 +107,16 @@ static bool check_mask(struct htable *ht, const struct obj val[], unsigned num) return true; } -int main(int argc, char *argv[]) +int main(void) { unsigned int i; - struct htable_obj ht; + struct htable_obj ht, ht2; struct obj val[NUM_VALS], *result; unsigned int dne; void *p; struct htable_obj_iter iter; - plan_tests(27); + plan_tests(29); for (i = 0; i < NUM_VALS; i++) val[i].key = i; dne = i; @@ -171,8 +171,12 @@ int main(int argc, char *argv[]) find_vals(&ht, val, NUM_VALS); ok1(!htable_obj_get(&ht, &dne)); + /* Check copy. */ + ok1(htable_obj_copy(&ht2, &ht)); + /* Delete them all by key. */ del_vals_bykey(&ht, val, NUM_VALS); + del_vals_bykey(&ht2, val, NUM_VALS); /* Write two of the same value. */ val[1] = val[0]; @@ -201,5 +205,6 @@ int main(int argc, char *argv[]) } htable_obj_clear(&ht); + htable_obj_clear(&ht2); return exit_status(); }