test(dijkstra): pcc toulouse insa
This commit is contained in:
parent
6db6644828
commit
1e3b3293a4
1 changed files with 5 additions and 4 deletions
|
@ -1,6 +1,6 @@
|
||||||
package org.insa.graphs.algorithm.shortestpath;
|
package org.insa.graphs.algorithm.shortestpath;
|
||||||
|
|
||||||
import static org.junit.Assert.*;
|
import static org.junit.Assert.fail;
|
||||||
|
|
||||||
import java.io.BufferedInputStream;
|
import java.io.BufferedInputStream;
|
||||||
import java.io.DataInputStream;
|
import java.io.DataInputStream;
|
||||||
|
@ -9,6 +9,7 @@ import java.io.FileNotFoundException;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
import org.insa.graphs.algorithm.ArcInspector;
|
import org.insa.graphs.algorithm.ArcInspector;
|
||||||
|
import org.insa.graphs.algorithm.ArcInspectorFactory;
|
||||||
import org.insa.graphs.model.Graph;
|
import org.insa.graphs.model.Graph;
|
||||||
import org.insa.graphs.model.Path;
|
import org.insa.graphs.model.Path;
|
||||||
import org.insa.graphs.model.io.BinaryGraphReader;
|
import org.insa.graphs.model.io.BinaryGraphReader;
|
||||||
|
@ -71,15 +72,15 @@ public class DijkstraAlgorithmTest {
|
||||||
// donner le path à afficher en renvoyant le path de dijkstra dans path.
|
// donner le path à afficher en renvoyant le path de dijkstra dans path.
|
||||||
// Chemin court => Bellman OK et vérifié. On compare les résultats obtenus par les 2 algos
|
// Chemin court => Bellman OK et vérifié. On compare les résultats obtenus par les 2 algos
|
||||||
public void testToulouseCourtChemin() {
|
public void testToulouseCourtChemin() {
|
||||||
ArcInspector arcInspector;
|
ArcInspector arcInspector = ArcInspectorFactory.getAllFilters().get(0);
|
||||||
ShortestPathData data = new ShortestPathData(this.graph, this.path.getOrigin(), this.path.getDestination(), null);
|
ShortestPathData data = new ShortestPathData(this.graph, this.path.getOrigin(), this.path.getDestination(), arcInspector);
|
||||||
|
|
||||||
DijkstraAlgorithm dijkstra = new DijkstraAlgorithm(data);
|
DijkstraAlgorithm dijkstra = new DijkstraAlgorithm(data);
|
||||||
ShortestPathSolution dijk_path = dijkstra.doRun();
|
ShortestPathSolution dijk_path = dijkstra.doRun();
|
||||||
|
|
||||||
BellmanFordAlgorithm bellman = new BellmanFordAlgorithm(data);
|
BellmanFordAlgorithm bellman = new BellmanFordAlgorithm(data);
|
||||||
ShortestPathSolution bell_path = bellman.doRun();
|
ShortestPathSolution bell_path = bellman.doRun();
|
||||||
assert(dijk_path.getPath() == bell_path.getPath());
|
assert(dijk_path.getPath().getLength() == bell_path.getPath().getLength());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Long chemin => Bellman trop long, on compare dijkstra au chemin récupéré directement
|
// Long chemin => Bellman trop long, on compare dijkstra au chemin récupéré directement
|
||||||
|
|
Loading…
Reference in a new issue