diff options
Diffstat (limited to 'tests/trie.c')
-rw-r--r-- | tests/trie.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/trie.c b/tests/trie.c index 0158fd8..6bc7549 100644 --- a/tests/trie.c +++ b/tests/trie.c @@ -82,6 +82,17 @@ int main(void) { assert(leaf->length == strlen(keys[i]) + 1); } + { + size_t i = 0; + TRIE_FOR_EACH(&trie, leaf) { + assert(leaf == trie_find_str(&trie, keys[i])); + assert(!leaf->prev || leaf->prev->next == leaf); + assert(!leaf->next || leaf->next->prev == leaf); + ++i; + } + assert(i == nkeys); + } + for (size_t i = 0; i < nkeys; ++i) { struct trie_leaf *leaf = trie_find_str(&trie, keys[i]); assert(leaf); @@ -110,6 +121,10 @@ int main(void) { } } + TRIE_FOR_EACH(&trie, leaf) { + assert(false); + } + // This tests the "jump" node handling on 32-bit platforms size_t longsize = 1 << 20; char *longstr = malloc(longsize); |