Add tests for Digraph::V and Digraph::E

This commit is contained in:
stefiosif
2022-07-26 20:39:57 +03:00
parent 41e5bead43
commit 46cdadc758

View File

@@ -45,4 +45,35 @@ TEST_SUITE("Graph") {
CHECK_EQ(R, X);
}
TEST_CASE("Digraph::V and Digraph::E") {
// 1 --> 2 --> 3 --> 1
// 3 --> 4 --> 5 --> 3
// 2 --> 6 --> 7 --> 8 --> 6
// 6 --> 9 --> 10 --> 11 --> 12 --> 13 --> 9
// 12 --> 10
Digraph<std::uint16_t> G;
G.insert(1, 2);
G.insert(2, 3);
G.insert(3, 1);
G.insert(3, 4);
G.insert(4, 5);
G.insert(5, 3);
G.insert(2, 6);
G.insert(6, 7);
G.insert(7, 8);
G.insert(7, 9);
G.insert(8, 6);
G.insert(6, 9);
G.insert(9, 10);
G.insert(10, 11);
G.insert(11, 12);
G.insert(12, 13);
G.insert(13, 9);
G.insert(12, 10);
REQUIRE_EQ(G.adjMatrix.size(), 13);
CHECK_EQ(G.V(), 13);
CHECK_EQ(G.E(), 18);
}
}