From 7841bfe55d4b5aa85e6d6f661f30f9eecbc84374 Mon Sep 17 00:00:00 2001 From: Tavian Barnes Date: Sat, 2 Nov 2024 11:18:37 -0400 Subject: trie: Get rid of the linked list of leaves --- tests/trie.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'tests') diff --git a/tests/trie.c b/tests/trie.c index 6e6024a..d69f37e 100644 --- a/tests/trie.c +++ b/tests/trie.c @@ -71,15 +71,14 @@ void check_trie(void) { bfs_verify(leaf); bfs_check(strcmp(keys[i], leaf->key) == 0); bfs_check(leaf->length == strlen(keys[i]) + 1); + leaf->value = (void *)keys[i]; } { size_t i = 0; for_trie (leaf, &trie) { - bfs_check(leaf == trie_find_str(&trie, keys[i])); - bfs_check(leaf == trie_insert_str(&trie, keys[i])); - bfs_check(!leaf->prev || leaf->prev->next == leaf); - bfs_check(!leaf->next || leaf->next->prev == leaf); + bfs_check(strcmp(leaf->value, leaf->key) == 0); + leaf->value = NULL; ++i; } bfs_check(i == nkeys); -- cgit v1.2.3