Skip to content

Commit

Permalink
Add dijkstra test for grapf with equale length edges
Browse files Browse the repository at this point in the history
  • Loading branch information
sbaldu committed Dec 15, 2023
1 parent bab31a9 commit f75ba07
Show file tree
Hide file tree
Showing 2 changed files with 141 additions and 0 deletions.
20 changes: 20 additions & 0 deletions test/Test_graph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -378,4 +378,24 @@ TEST_CASE("Dijkstra") {
auto result = graph.shortestPath(1, 3);
CHECK_FALSE(result.has_value());
}

SUBCASE("equal length") {
Graph graph{};
graph.importMatrix("./data/rawMatrix.dat", false);
// check correct import
CHECK_EQ(graph.adjMatrix()->max_size(), 14400);
CHECK_EQ(graph.adjMatrix()->getRowDim(), 120);
CHECK_EQ(graph.adjMatrix()->getColDim(), 120);
CHECK_EQ(graph.adjMatrix()->size(), 436);
// check that the path exists
CHECK(graph.adjMatrix()->operator()(46, 58));
CHECK(graph.adjMatrix()->operator()(58, 70));
CHECK(graph.adjMatrix()->operator()(70, 82));
CHECK(graph.adjMatrix()->operator()(82, 94));
CHECK(graph.adjMatrix()->operator()(94, 106));
CHECK(graph.adjMatrix()->operator()(106, 118));

auto result = graph.shortestPath(46, 118);
CHECK(result.has_value());
}
}
Loading

0 comments on commit f75ba07

Please sign in to comment.