Update tarjan test cases and add BFS test case
This commit is contained in:
@@ -8,9 +8,9 @@
|
||||
|
||||
using namespace graph;
|
||||
|
||||
TEST_SUITE("Graph.") {
|
||||
TEST_SUITE("Graph") {
|
||||
|
||||
TEST_CASE("SCC") {
|
||||
TEST_CASE("SCC T1") {
|
||||
// 1 --> 2 --> 4 --> 1
|
||||
// 2 --> 3 --> 5 --> 7 --> 3
|
||||
// 5 --> 9 --> 6 --> 8 --> 9
|
||||
@@ -27,7 +27,30 @@ TEST_SUITE("Graph.") {
|
||||
G.insert(8, 9);
|
||||
G.insert(9, 6);
|
||||
|
||||
REQUIRE_EQ(G.vertices.size(), 9);
|
||||
|
||||
algo::Tarjan<std::uint16_t> tarjan(G);
|
||||
auto SCCs = tarjan.run();
|
||||
auto sccs = tarjan.run();
|
||||
}
|
||||
|
||||
TEST_CASE("SCC T2") {
|
||||
// 1 --> 2 --> 5 --> 7 --> 2
|
||||
// 1 --> 4 --> 3 --> 1
|
||||
// 4 --> 6 --> 3
|
||||
Digraph<std::uint16_t> 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);
|
||||
|
||||
REQUIRE_EQ(G.vertices.size(), 7);
|
||||
|
||||
algo::Tarjan<std::uint16_t> tarjan(G);
|
||||
auto sccs = tarjan.run();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user