This commit is contained in:
Clement Lacau 2024-05-03 14:49:19 +02:00
parent 24012e3afc
commit 632662ee75

View file

@ -24,6 +24,7 @@ import java.awt.Dimension;
import java.io.BufferedInputStream; import java.io.BufferedInputStream;
import java.io.DataInputStream; import java.io.DataInputStream;
import java.io.FileInputStream; import java.io.FileInputStream;
import java.io.FileNotFoundException;
import javax.swing.JFrame; import javax.swing.JFrame;
import javax.swing.SwingUtilities; import javax.swing.SwingUtilities;
@ -34,10 +35,16 @@ import org.insa.graphs.model.io.BinaryGraphReader;
import org.insa.graphs.model.io.BinaryPathReader; import org.insa.graphs.model.io.BinaryPathReader;
import org.insa.graphs.model.io.GraphReader; import org.insa.graphs.model.io.GraphReader;
import org.insa.graphs.model.io.PathReader; import org.insa.graphs.model.io.PathReader;
import java.io.IOException;
public class DijkstraAlgorithmTest { public class DijkstraAlgorithmTest {
// TODO finish this // TODO finish this
public GraphReader reader;
public Graph graph;
public PathReader pathReader;
public Path path;
@Before @Before
public 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.
@ -46,22 +53,28 @@ public class DijkstraAlgorithmTest {
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.
final GraphReader reader = new BinaryGraphReader( try {
new DataInputStream(new BufferedInputStream(new FileInputStream(mapName)))); final GraphReader reader = new BinaryGraphReader(
new DataInputStream(new BufferedInputStream(new FileInputStream(mapName))));
// Read the graph. X // Read the graph. X
final Graph graph = reader.read(); final Graph graph = reader.read();
// Create a PathReader. // Create a PathReader.
final PathReader pathReader = new BinaryPathReader(new DataInputStream(new BufferedInputStream(new FileInputStream(pathName)))); final PathReader pathReader = new BinaryPathReader(new DataInputStream(new BufferedInputStream(new FileInputStream(pathName))));
// Read the path.
final Path path = pathReader.readPath(graph);
// Read the path.
final Path path = pathReader.readPath(graph);
}
catch (IOException e ) {}
} }
@Test @Test
public void testIsEmpty() { // TODO
assertEquals(parameters.data.length == 0, this.queue.isEmpty()); // fonction pour code au dessus
// appeler constructeur dijkstra
// donner le path à afficher en renvoyant le path de dijkstra dans path.
public void Test_Dijkstra() {
} }
} }