Comparar commits
2 commits
72b117f83b
...
bbd6fac17f
| Autor | SHA1 | Data | |
|---|---|---|---|
| bbd6fac17f | |||
| f289793c44 |
1 arquivos alterados com 12 adições e 11 exclusões
|
|
@ -21,18 +21,19 @@ import org.junit.Test;
|
|||
public class DijkstraAlgorithmTest {
|
||||
|
||||
// TODO finish this
|
||||
public GraphReader reader;
|
||||
public Graph graph;
|
||||
public PathReader pathReader;
|
||||
public Path path;
|
||||
public static GraphReader reader;
|
||||
public static Graph graph;
|
||||
public static PathReader pathReader;
|
||||
public static Path path;
|
||||
|
||||
|
||||
@BeforeClass
|
||||
public void init() {
|
||||
public static void init() {
|
||||
// Visit these directory to see the list of available files on Commetud.
|
||||
// When running with VSC, paths are relative to the BE_Graphes directory.
|
||||
final String mapName = "./Maps/insa.mapgr";
|
||||
final String pathName = "./Paths/path_fr31insa_rangueil_r2.path";
|
||||
final String mapName = "../Maps/insa.mapgr";
|
||||
|
||||
final String pathName = "../Paths/path_fr31insa_rangueil_r2.path";
|
||||
System.out.println("Working Directory = " + System.getProperty("user.dir"));
|
||||
// Create a graph reader.
|
||||
try {
|
||||
|
|
@ -40,7 +41,7 @@ public class DijkstraAlgorithmTest {
|
|||
new DataInputStream(new BufferedInputStream(new FileInputStream(mapName))));
|
||||
|
||||
// Read the graph. X
|
||||
this.graph = reader.read();
|
||||
graph = reader.read();
|
||||
// free resources
|
||||
reader.close();
|
||||
|
||||
|
|
@ -50,7 +51,7 @@ public class DijkstraAlgorithmTest {
|
|||
pathReader.close();
|
||||
|
||||
// Read the path.
|
||||
this.path = pathReader.readPath(graph);
|
||||
path = pathReader.readPath(graph);
|
||||
}
|
||||
catch (FileNotFoundException e) {
|
||||
System.err.println("File not found: " + e.getMessage());
|
||||
|
|
@ -68,7 +69,6 @@ public class DijkstraAlgorithmTest {
|
|||
// appeler constructeur dijkstra
|
||||
// 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 Test_Toulouse_court_chemin() {
|
||||
ArcInspector arcInspector;
|
||||
ShortestPathData data = new ShortestPathData(this.graph, this.path.getOrigin(), this.path.getDestination(), null);
|
||||
|
||||
|
|
@ -78,10 +78,11 @@ public class DijkstraAlgorithmTest {
|
|||
BellmanFordAlgorithm bellman = new BellmanFordAlgorithm(data);
|
||||
ShortestPathSolution bell_path = bellman.doRun();
|
||||
assert(dijk_path.getPath() == bell_path.getPath());
|
||||
public void testToulouseCourtChemin() {
|
||||
}
|
||||
|
||||
// Long chemin => Bellman trop long, on compare dijkstra au chemin récupéré directement
|
||||
public void Test_Toulouse_long_chemin() {
|
||||
public void testToulouseLongChemin() {
|
||||
init();
|
||||
ArcInspector arcInspector;
|
||||
ShortestPathData data = new ShortestPathData(this.graph, this.path.getOrigin(), this.path.getDestination(), null);
|
||||
|
|
|
|||
Carregando…
Referência em uma nova issue