Skip to content

Commit

Permalink
adding a couple more corner case tests
Browse files Browse the repository at this point in the history
  • Loading branch information
AsherGlick committed Sep 22, 2023
1 parent 458d6aa commit 847a1fc
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions xml_converter/tests/test_string_hierarchy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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();
Expand Down

0 comments on commit 847a1fc

Please sign in to comment.