summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2014-10-01 15:50:28 +0000
committerDavid Robillard <d@drobilla.net>2014-10-01 15:50:28 +0000
commitb10ae60816015d85ed9aa27fdb98d1b0f6bfdf64 (patch)
tree5e2307f443633b9c4bbf8bc96cfeaff5ff2337f8 /test
parentdee23c2058fd33e14610ceda277c11e4d8ce768b (diff)
downloadzix-b10ae60816015d85ed9aa27fdb98d1b0f6bfdf64.tar.gz
zix-b10ae60816015d85ed9aa27fdb98d1b0f6bfdf64.tar.bz2
zix-b10ae60816015d85ed9aa27fdb98d1b0f6bfdf64.zip
Improve ZixPatree with more compact index.
git-svn-id: http://svn.drobilla.net/zix/trunk@95 df6676b4-ccc9-40e5-b5d6-7c4628a128e3
Diffstat (limited to 'test')
-rw-r--r--test/dict_bench.c2
-rw-r--r--test/patree_test.c8
2 files changed, 6 insertions, 4 deletions
diff --git a/test/dict_bench.c b/test/dict_bench.c
index d7407d3..a940ed2 100644
--- a/test/dict_bench.c
+++ b/test/dict_bench.c
@@ -128,7 +128,7 @@ main(int argc, char** argv)
// ZixPatree
insert_start = bench_start();
for (size_t i = 0; i < n; ++i) {
- ZixStatus st = zix_patree_insert(patree, strings[i]);
+ ZixStatus st = zix_patree_insert(patree, strings[i], lengths[i]);
if (st && st != ZIX_STATUS_EXISTS) {
return test_fail("Failed to insert `%s'\n", strings[i]);
}
diff --git a/test/patree_test.c b/test/patree_test.c
index 6d30509..c28ec40 100644
--- a/test/patree_test.c
+++ b/test/patree_test.c
@@ -63,17 +63,19 @@ main(int argc, char** argv)
// Insert each string
for (size_t i = 0; i < n_strings; ++i) {
- ZixStatus st = zix_patree_insert(patree, strings[i]);
+ ZixStatus st = zix_patree_insert(patree, strings[i], strlen(strings[i]));
if (st) {
return test_fail("Failed to insert `%s'\n", strings[i]);
}
}
- //zix_patree_print_dot(patree, stdout);
+ FILE* dot_file = fopen("patree.dot", "w");
+ zix_patree_print_dot(patree, dot_file);
+ fclose(dot_file);
// Attempt to insert each string again
for (size_t i = 0; i < n_strings; ++i) {
- ZixStatus st = zix_patree_insert(patree, strings[i]);
+ ZixStatus st = zix_patree_insert(patree, strings[i], strlen(strings[i]));
if (st != ZIX_STATUS_EXISTS) {
return test_fail("Double inserted `%s'\n", strings[i]);
}