#include #include "graph/scc.h" #include "graph/digraph.h" #include "algorithm/tarjan.h" #include "tree/breadth_first_tree.h" #include using namespace graph; using namespace tree; TEST_SUITE("Tree") { TEST_CASE("Breadth First Tree") { // 1 --> 2 --> 5 --> 7 --> 2 // 1 --> 4 --> 3 --> 1 // 4 --> 6 --> 3 Digraph G; G.insert(1, 2); G.insert(1, 4); G.insert(2, 5); G.insert(3, 1); G.insert(4, 3); G.insert(4, 6); G.insert(5, 7); G.insert(6, 3); G.insert(7, 2); BreadthFirstTree tree(G); std::map> exp = { {1, {2, 4}}, {2, {5}}, {4, {3, 6}}, {5, {7}} }; CHECK_EQ(tree.adjMatrix, exp); } }