-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_Forest.cpp
More file actions
27 lines (17 loc) · 902 Bytes
/
Copy pathtest_Forest.cpp
File metadata and controls
27 lines (17 loc) · 902 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#include "catch.hpp"
#include "Forest.hpp" // °üº¬ÄãµÄ WQUPCUFSet ÀඨÒå
TEST_CASE("Forest functionality tests", "[Forest]") {
Forest<std::string, int> forest;
REQUIRE(forest.insert("Root") == true);
REQUIRE(forest.insert("Child1", "Root", 1) == true);
REQUIRE(forest.insert("Child2", "Root", 2) == true);
REQUIRE(forest.insert("Root2") == true);
REQUIRE(forest.insert("Child3", "Root2", 3) == true);
REQUIRE(forest.insert("Child4", "Root2", 4) == true);
// Testing exception for inserting existing node
//REQUIRE_THROWS_AS(forest.insert("Root"), std::runtime_error);
// Testing exception for inserting with non-existent parent
//REQUIRE_THROWS_AS(forest.insert("Child3", "NonExistent", 3), std::runtime_error);
REQUIRE(forest.getCount() == 6);
forest.printWholeForest();
}