7 int ivals[] = {0,1,2,3,4,5,6,7,8,9};
9 unsigned long djb2hash(const void *x)
12 uint_fast32_t hash = 5381;
16 while ( (c = *str++) )
21 int scmp(const void *a, const void *b, void *aux)
29 hashmap *h = hm_new(0, djb2hash, scmp, NULL);
30 assert(hm_length(h) == 0);
31 assert(hm_is_empty(h));
33 assert(!hm_at(h, "zero"));
34 hm_insert(h, "zero", ivals);
35 assert(hm_length(h) == 1);
36 assert(*(int*)hm_at(h, "zero") == 0);
38 hm_insert(h, "one", ivals+1);
39 assert(hm_length(h) == 2);
40 assert(*(int*)hm_at(h, "zero") == 0);
41 assert(*(int*)hm_at(h, "one") == 1);
42 assert(!hm_at(h, "flurgle"));
45 assert(!hm_at(h, "one"));
48 assert(hm_length(h) == 0);
49 assert(!hm_at(h, "zero"));