void test_hattrie_insert() { fprintf(stderr, "inserting %zu keys ... \n", k); size_t i, j; value_t* u; value_t v; for (j = 0; j < k; ++j) { i = rand() % n; v = 1 + str_map_get(M, xs[i], strlen(xs[i])); str_map_set(M, xs[i], strlen(xs[i]), v); u = hattrie_get(T, xs[i], strlen(xs[i])); *u += 1; if (*u != v) { fprintf(stderr, "[error] tally mismatch (reported: %lu, correct: %lu)\n", *u, v); } } fprintf(stderr, "sizeof: %zu\n", hattrie_sizeof(T)); fprintf(stderr, "deleting %zu keys ... \n", d); for (j = 0; j < d; ++j) { str_map_del(M, ds[j], strlen(ds[j])); hattrie_del(T, ds[j], strlen(ds[j])); u = hattrie_tryget(T, ds[j], strlen(ds[j])); if (u) { fprintf(stderr, "[error] item %zu still found in trie after delete\n", j); } } fprintf(stderr, "done.\n"); }
size_t AlnIndex::used_memory() const { return hattrie_sizeof(t); }