Skip to content

Commit

Permalink
Add tests for the wildcard (second) result
Browse files Browse the repository at this point in the history
  • Loading branch information
ramon-bernardo committed Sep 6, 2024
1 parent ce0fee0 commit 0a3b8c1
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/tests/test_wildcard_tree.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ BOOST_AUTO_TEST_CASE(test_wildcard_tree_single_words)

BOOST_CHECK_EQUAL(root.search("tes").first, WildcardTreeNode::NotFound);
BOOST_CHECK_EQUAL(root.search("test").first, WildcardTreeNode::Found);
BOOST_CHECK_EQUAL(root.search("test").second, "test");
BOOST_CHECK_EQUAL(root.search("testing").first, WildcardTreeNode::NotFound);
}

Expand All @@ -26,6 +27,7 @@ BOOST_AUTO_TEST_CASE(test_wildcard_tree_ambiguity)

BOOST_CHECK_EQUAL(root.search("te").first, WildcardTreeNode::Ambiguous);
BOOST_CHECK_EQUAL(root.search("test").first, WildcardTreeNode::Found);
BOOST_CHECK_EQUAL(root.search("test").second, "test");
}

BOOST_AUTO_TEST_CASE(test_wildcard_tree_remove)
Expand All @@ -34,6 +36,7 @@ BOOST_AUTO_TEST_CASE(test_wildcard_tree_remove)

root.insert("test");
BOOST_CHECK_EQUAL(root.search("test").first, WildcardTreeNode::Found);
BOOST_CHECK_EQUAL(root.search("test").second, "test");

root.remove("test");
BOOST_CHECK_EQUAL(root.search("test").first, WildcardTreeNode::NotFound);
Expand All @@ -47,8 +50,10 @@ BOOST_AUTO_TEST_CASE(test_wildcard_tree_partial_search)

BOOST_CHECK_EQUAL(root.search("te").first, WildcardTreeNode::Ambiguous);
BOOST_CHECK_EQUAL(root.search("test").first, WildcardTreeNode::Found);
BOOST_CHECK_EQUAL(root.search("test").second, "test");

root.remove("test");
BOOST_CHECK_EQUAL(root.search("te").first, WildcardTreeNode::Found);
BOOST_CHECK_EQUAL(root.search("te").second, "te");
BOOST_CHECK_EQUAL(root.search("test").first, WildcardTreeNode::NotFound);
}

0 comments on commit 0a3b8c1

Please sign in to comment.