X-Git-Url: http://git.ozlabs.org/?p=ccan;a=blobdiff_plain;f=ccan%2Fhtable%2Ftest%2Frun-type.c;h=aca9c59488240f7e3b9e0090ac15256120c7a59f;hp=02dac29e10012f9f83f8451af73bfd05b545f10a;hb=45f24da35118db441e6153f02f6ddd937da1fa1c;hpb=23e4603462692031a29ea4b2a882f957de4f2922 diff --git a/ccan/htable/test/run-type.c b/ccan/htable/test/run-type.c index 02dac29e..aca9c594 100644 --- a/ccan/htable/test/run-type.c +++ b/ccan/htable/test/run-type.c @@ -4,7 +4,8 @@ #include #include -#define NUM_VALS (1 << HTABLE_BASE_BITS) +#define NUM_BITS 7 +#define NUM_VALS (1 << NUM_BITS) struct obj { /* Makes sure we don't try to treat and obj as a key or vice versa */ @@ -23,7 +24,7 @@ static const unsigned int *objkey(const struct obj *obj) static size_t objhash(const unsigned int *key) { size_t h = *key / 2; - h |= -1UL << HTABLE_BASE_BITS; + h |= -1UL << NUM_BITS; return h; } @@ -121,15 +122,15 @@ int main(int argc, char *argv[]) dne = i; ht = htable_obj_new(); - ok1(((struct htable *)ht)->max < (1 << ((struct htable *)ht)->bits)); - ok1(((struct htable *)ht)->bits == HTABLE_BASE_BITS); + ok1(((struct htable *)ht)->max == 0); + ok1(((struct htable *)ht)->bits == 0); /* We cannot find an entry which doesn't exist. */ ok1(!htable_obj_get(ht, &dne)); - /* Fill it, it should increase in size (once). */ + /* Fill it, it should increase in size. */ add_vals(ht, val, NUM_VALS); - ok1(((struct htable *)ht)->bits == HTABLE_BASE_BITS + 1); + ok1(((struct htable *)ht)->bits == NUM_BITS + 1); ok1(((struct htable *)ht)->max < (1 << ((struct htable *)ht)->bits)); /* Mask should be set. */