refactor(test): dijkstra no path assertion
This commit is contained in:
parent
0ad795a8c4
commit
f62e312156
1 changed files with 16 additions and 12 deletions
|
@ -92,6 +92,19 @@ public class DijkstraAlgorithmTest {
|
||||||
assert(Math.abs(dijk_path.getPath().getLength() - bell_path.getPath().getLength()) < 1.0);
|
assert(Math.abs(dijk_path.getPath().getLength() - bell_path.getPath().getLength()) < 1.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Verifies that no path is found
|
||||||
|
*/
|
||||||
|
private void assertNoPathFound(Graph graph, Node origin, Node destination, ArcInspector arcFilter) {
|
||||||
|
ShortestPathData data = new ShortestPathData(graph, origin, destination, arcFilter);
|
||||||
|
|
||||||
|
DijkstraAlgorithm dijkstra = new DijkstraAlgorithm(data);
|
||||||
|
ShortestPathSolution dijk_path = dijkstra.doRun();
|
||||||
|
|
||||||
|
assert(!dijk_path.isFeasible());
|
||||||
|
assert(dijk_path.getPath() == null);
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
/*
|
/*
|
||||||
* Map: carre.mapgr
|
* Map: carre.mapgr
|
||||||
|
@ -137,13 +150,8 @@ public class DijkstraAlgorithmTest {
|
||||||
Graph myGraph = graph.get(0);
|
Graph myGraph = graph.get(0);
|
||||||
Node origin = myGraph.get(3);
|
Node origin = myGraph.get(3);
|
||||||
Node destination = myGraph.get(3);
|
Node destination = myGraph.get(3);
|
||||||
ShortestPathData data = new ShortestPathData(myGraph, origin, destination, arcInspector);
|
|
||||||
|
|
||||||
DijkstraAlgorithm dijkstra = new DijkstraAlgorithm(data);
|
assertNoPathFound(myGraph, origin, destination, arcInspector);
|
||||||
ShortestPathSolution dijk_path = dijkstra.doRun();
|
|
||||||
|
|
||||||
assert(!dijk_path.isFeasible());
|
|
||||||
assert(dijk_path.getPath() == null);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -159,12 +167,8 @@ public class DijkstraAlgorithmTest {
|
||||||
Graph myGraph = graph.get(1);
|
Graph myGraph = graph.get(1);
|
||||||
Node origin = myGraph.get(224);
|
Node origin = myGraph.get(224);
|
||||||
Node destination = myGraph.get(814);
|
Node destination = myGraph.get(814);
|
||||||
ShortestPathData data = new ShortestPathData(myGraph, origin, destination, arcInspector);
|
|
||||||
|
|
||||||
DijkstraAlgorithm dijkstra = new DijkstraAlgorithm(data);
|
assertNoPathFound(myGraph, origin, destination, arcInspector);
|
||||||
ShortestPathSolution dijk_path = dijkstra.doRun();
|
|
||||||
assert(!dijk_path.isFeasible());
|
|
||||||
assert(dijk_path.getPath() == null);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
Loading…
Reference in a new issue