Add tests for same SCC O(1) query

This commit is contained in:
stefiosif
2022-06-29 17:33:27 +03:00
parent 8d8e6ef831
commit d199b7de17
4 changed files with 23 additions and 11 deletions

View File

@@ -30,7 +30,7 @@ TEST_SUITE("Algorithm") {
REQUIRE_EQ(G.vertices.size(), 9);
algo::Tarjan<std::uint16_t> tarjan(G);
auto res = tarjan.run();
auto res = tarjan.findSCC();
std::vector<std::vector<std::uint16_t>> exp = {
{6, 8, 9},
@@ -63,7 +63,7 @@ TEST_SUITE("Algorithm") {
REQUIRE_EQ(G.vertices.size(), 7);
algo::Tarjan<std::uint16_t> tarjan(G);
auto res = tarjan.run();
auto res = tarjan.findSCC();
std::vector<std::vector<std::uint16_t>> exp = {
{2, 5, 7},
@@ -133,6 +133,18 @@ TEST_SUITE("Algorithm") {
algo::DecrementalSCC<std::uint16_t> rz(G);
rz.init();
std::vector<std::vector<std::uint16_t>> exp = {
{2, 5, 7},
{1, 3, 4, 6}
};
CHECK_EQ(rz.query(1, 2), false);
CHECK_EQ(rz.query(1, 3), true);
CHECK_EQ(rz.query(1, 7), false);
CHECK_EQ(rz.query(2, 3), false);
CHECK_EQ(rz.query(2, 5), true);
CHECK_EQ(rz.query(5, 7), true);
//CHECK_EQ(rz.query(1, 2), true);
}
}

View File

@@ -67,7 +67,7 @@ TEST_SUITE("Graph") {
REQUIRE_EQ(G.vertices.size(), 9);
algo::Tarjan<std::uint16_t> tarjan(G);
auto sccs = tarjan.run();
auto sccs = tarjan.findSCC();
}
TEST_CASE("SCC T2") {
@@ -88,6 +88,6 @@ TEST_SUITE("Graph") {
REQUIRE_EQ(G.vertices.size(), 7);
algo::Tarjan<std::uint16_t> tarjan(G);
auto sccs = tarjan.run();
auto sccs = tarjan.findSCC();
}
}