From 847a1fc47d656c150cb9dcdf514c5026fdee693f Mon Sep 17 00:00:00 2001 From: Asher Glick Date: Fri, 22 Sep 2023 04:07:18 -0500 Subject: [PATCH] adding a couple more corner case tests --- xml_converter/tests/test_string_hierarchy.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/xml_converter/tests/test_string_hierarchy.cpp b/xml_converter/tests/test_string_hierarchy.cpp index c4c6243e..7eed8a30 100644 --- a/xml_converter/tests/test_string_hierarchy.cpp +++ b/xml_converter/tests/test_string_hierarchy.cpp @@ -42,6 +42,8 @@ TEST_F(StringHierarchyTest, NonExistantDepthNode) { TEST_F(StringHierarchyTest, AllExistDepthNode) { string_hierarchy.add_path({"root", "child1", "child2"}, true); EXPECT_TRUE(string_hierarchy.in_hierarchy({"root", "child1", "child2", "child3"})); + EXPECT_TRUE(string_hierarchy.in_hierarchy({"root", "child1", "child2"})); + EXPECT_FALSE(string_hierarchy.in_hierarchy({"root", "child1", "child2b"})); } TEST_F(StringHierarchyTest, DoubleNode) { @@ -60,6 +62,11 @@ TEST_F(StringHierarchyTest, OverwriteAllChildrenRoot) { EXPECT_TRUE(string_hierarchy.in_hierarchy({"root", "somethingrandom"})); } +TEST_F(StringHierarchyTest, AllowAll) { + string_hierarchy.add_path({}, true); + EXPECT_TRUE(string_hierarchy.in_hierarchy({"literally", "anything"})); +} + int main(int argc, char **argv) { ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS();