From 0a3b8c187cf3b2b13a4e98411eb53da30e78e651 Mon Sep 17 00:00:00 2001 From: ramon-bernardo Date: Thu, 5 Sep 2024 22:23:06 -0300 Subject: [PATCH] Add tests for the wildcard (second) result --- src/tests/test_wildcard_tree.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/tests/test_wildcard_tree.cpp b/src/tests/test_wildcard_tree.cpp index 42f7adba51..06d2388642 100644 --- a/src/tests/test_wildcard_tree.cpp +++ b/src/tests/test_wildcard_tree.cpp @@ -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); } @@ -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) @@ -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); @@ -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); }