diff options
author | Rusty Russell <rusty@rustcorp.com.au> | 2011-12-05 16:42:47 +1030 |
---|---|---|
committer | Rusty Russell <rusty@rustcorp.com.au> | 2011-12-05 16:42:47 +1030 |
commit | 19409ddaf2414dd1d8ef183c834b37c8767034b0 (patch) | |
tree | dac5462b73e3588729d80dd4be44bcadf949f4c3 /lib/ccan/htable/test/run-type.c | |
parent | 1beb793664dba184892b23dced4a3676fb94ff9f (diff) | |
download | samba-19409ddaf2414dd1d8ef183c834b37c8767034b0.tar.gz samba-19409ddaf2414dd1d8ef183c834b37c8767034b0.tar.bz2 samba-19409ddaf2414dd1d8ef183c834b37c8767034b0.zip |
lib/ccan/htable: start empty.
There's no real reason to start with 128 entries.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
(Imported from CCAN commit 45f24da35118db441e6153f02f6ddd937da1fa1c)
Diffstat (limited to 'lib/ccan/htable/test/run-type.c')
-rw-r--r-- | lib/ccan/htable/test/run-type.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/lib/ccan/htable/test/run-type.c b/lib/ccan/htable/test/run-type.c index 02dac29e10..aca9c59488 100644 --- a/lib/ccan/htable/test/run-type.c +++ b/lib/ccan/htable/test/run-type.c @@ -4,7 +4,8 @@ #include <stdbool.h> #include <string.h> -#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. */ |