Compare commits
No commits in common. "bbd6fac17f29f6fabd83706cce5a215c0020544e" and "72b117f83b12715dfea7f8b80df08aaf56d1811f" have entirely different histories.
bbd6fac17f
...
72b117f83b
1 changed files with 11 additions and 12 deletions
|
|
@ -21,19 +21,18 @@ import org.junit.Test;
|
||||||
public class DijkstraAlgorithmTest {
|
public class DijkstraAlgorithmTest {
|
||||||
|
|
||||||
// TODO finish this
|
// TODO finish this
|
||||||
public static GraphReader reader;
|
public GraphReader reader;
|
||||||
public static Graph graph;
|
public Graph graph;
|
||||||
public static PathReader pathReader;
|
public PathReader pathReader;
|
||||||
public static Path path;
|
public Path path;
|
||||||
|
|
||||||
|
|
||||||
@BeforeClass
|
@BeforeClass
|
||||||
public static void init() {
|
public void init() {
|
||||||
// Visit these directory to see the list of available files on Commetud.
|
// Visit these directory to see the list of available files on Commetud.
|
||||||
// When running with VSC, paths are relative to the BE_Graphes directory.
|
// When running with VSC, paths are relative to the BE_Graphes directory.
|
||||||
final String mapName = "../Maps/insa.mapgr";
|
final String mapName = "./Maps/insa.mapgr";
|
||||||
|
final String pathName = "./Paths/path_fr31insa_rangueil_r2.path";
|
||||||
final String pathName = "../Paths/path_fr31insa_rangueil_r2.path";
|
|
||||||
System.out.println("Working Directory = " + System.getProperty("user.dir"));
|
System.out.println("Working Directory = " + System.getProperty("user.dir"));
|
||||||
// Create a graph reader.
|
// Create a graph reader.
|
||||||
try {
|
try {
|
||||||
|
|
@ -41,7 +40,7 @@ public class DijkstraAlgorithmTest {
|
||||||
new DataInputStream(new BufferedInputStream(new FileInputStream(mapName))));
|
new DataInputStream(new BufferedInputStream(new FileInputStream(mapName))));
|
||||||
|
|
||||||
// Read the graph. X
|
// Read the graph. X
|
||||||
graph = reader.read();
|
this.graph = reader.read();
|
||||||
// free resources
|
// free resources
|
||||||
reader.close();
|
reader.close();
|
||||||
|
|
||||||
|
|
@ -51,7 +50,7 @@ public class DijkstraAlgorithmTest {
|
||||||
pathReader.close();
|
pathReader.close();
|
||||||
|
|
||||||
// Read the path.
|
// Read the path.
|
||||||
path = pathReader.readPath(graph);
|
this.path = pathReader.readPath(graph);
|
||||||
}
|
}
|
||||||
catch (FileNotFoundException e) {
|
catch (FileNotFoundException e) {
|
||||||
System.err.println("File not found: " + e.getMessage());
|
System.err.println("File not found: " + e.getMessage());
|
||||||
|
|
@ -69,6 +68,7 @@ public class DijkstraAlgorithmTest {
|
||||||
// appeler constructeur dijkstra
|
// appeler constructeur dijkstra
|
||||||
// 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 Test_Toulouse_court_chemin() {
|
||||||
ArcInspector arcInspector;
|
ArcInspector arcInspector;
|
||||||
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(), null);
|
||||||
|
|
||||||
|
|
@ -78,11 +78,10 @@ public class DijkstraAlgorithmTest {
|
||||||
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() == bell_path.getPath());
|
||||||
public void testToulouseCourtChemin() {
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 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
|
||||||
public void testToulouseLongChemin() {
|
public void Test_Toulouse_long_chemin() {
|
||||||
init();
|
init();
|
||||||
ArcInspector arcInspector;
|
ArcInspector arcInspector;
|
||||||
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(), null);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue