diff --git a/be-graphes-algos/src/test/java/org/insa/graphs/algorithm/shortestpath/DijkstraAlgorithmTest.java b/be-graphes-algos/src/test/java/org/insa/graphs/algorithm/shortestpath/DijkstraAlgorithmTest.java new file mode 100644 index 0000000..1f2b37a --- /dev/null +++ b/be-graphes-algos/src/test/java/org/insa/graphs/algorithm/shortestpath/DijkstraAlgorithmTest.java @@ -0,0 +1,67 @@ +package org.insa.graphs.algorithm.shortestpath; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.Collections; +import java.util.List; +import java.util.stream.IntStream; + +import org.junit.Assume; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; +import org.junit.runners.Parameterized.Parameter; +import org.junit.runners.Parameterized.Parameters; + +import java.awt.BorderLayout; +import java.awt.Dimension; +import java.io.BufferedInputStream; +import java.io.DataInputStream; +import java.io.FileInputStream; + +import javax.swing.JFrame; +import javax.swing.SwingUtilities; + +import org.insa.graphs.model.Graph; +import org.insa.graphs.model.Path; +import org.insa.graphs.model.io.BinaryGraphReader; +import org.insa.graphs.model.io.BinaryPathReader; +import org.insa.graphs.model.io.GraphReader; +import org.insa.graphs.model.io.PathReader; + +public class DijkstraAlgorithmTest { + + // TODO finish this + @Before + public 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"; + System.out.println("Working Directory = " + System.getProperty("user.dir")); + // Create a graph reader. + final GraphReader reader = new BinaryGraphReader( + new DataInputStream(new BufferedInputStream(new FileInputStream(mapName)))); + + // Read the graph. X + final Graph graph = reader.read(); + + // Create a PathReader. + final PathReader pathReader = new BinaryPathReader(new DataInputStream(new BufferedInputStream(new FileInputStream(pathName)))); + + // Read the path. + final Path path = pathReader.readPath(graph); + + } + + @Test + public void testIsEmpty() { + assertEquals(parameters.data.length == 0, this.queue.isEmpty()); + } +}