test(dijkstra): pcc toulouse insa

This commit is contained in:
Paul Alnet 2024-05-17 08:55:55 +02:00
parent 6db6644828
commit 1e3b3293a4

View file

@ -1,6 +1,6 @@
package org.insa.graphs.algorithm.shortestpath;
import static org.junit.Assert.*;
import static org.junit.Assert.fail;
import java.io.BufferedInputStream;
import java.io.DataInputStream;
@ -9,6 +9,7 @@ import java.io.FileNotFoundException;
import java.io.IOException;
import org.insa.graphs.algorithm.ArcInspector;
import org.insa.graphs.algorithm.ArcInspectorFactory;
import org.insa.graphs.model.Graph;
import org.insa.graphs.model.Path;
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.
// Chemin court => Bellman OK et vérifié. On compare les résultats obtenus par les 2 algos
public void testToulouseCourtChemin() {
ArcInspector arcInspector;
ShortestPathData data = new ShortestPathData(this.graph, this.path.getOrigin(), this.path.getDestination(), null);
ArcInspector arcInspector = ArcInspectorFactory.getAllFilters().get(0);
ShortestPathData data = new ShortestPathData(this.graph, this.path.getOrigin(), this.path.getDestination(), arcInspector);
DijkstraAlgorithm dijkstra = new DijkstraAlgorithm(data);
ShortestPathSolution dijk_path = dijkstra.doRun();
BellmanFordAlgorithm bellman = new BellmanFordAlgorithm(data);
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