diff options
Diffstat (limited to 'tests/htrie.c')
-rw-r--r-- | tests/htrie.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/htrie.c b/tests/htrie.c new file mode 100644 index 0000000..2c70b38 --- /dev/null +++ b/tests/htrie.c @@ -0,0 +1,22 @@ +#include <assert.h> + +#define HTRIE_TYPE int +#define HTRIE_KEY int +#define HTRIE_HASH conts_inthash +#define HTRIE_CMP(a, b) ((a) - (b)) +#define HTRIE_NAME ints +#include <conts/htrie.h> + +int main() +{ + struct ints ints = ints_create(); + for (int i = 0; i < 1000000; ++i) { + ints_insert(&ints, i, i); + } + + for (int i = 0; i < 1000000; ++i) { + int *v = ints_at(&ints, i); + assert(v && *v == i); + } + ints_destroy(&ints); +} |