From bc6e91b21da02b78bcf06368ffabc764284b7837 Mon Sep 17 00:00:00 2001 From: Bafo Date: Fri, 19 May 2023 18:11:20 +0200 Subject: [PATCH] Test junit prblm dijkstra --- .vscode/launch.json | 35 ---- be-graphes-algos/.classpath | 27 --- .../.settings/org.eclipse.jdt.apt.core.prefs | 2 + .../.settings/org.eclipse.jdt.core.prefs | 1 + .../shortestpath/AStarAlgorithm.java | 23 +-- .../shortestpath/DijkstraAlgorithm.java | 60 ++---- .../algorithm/utils/AStarAlgorithmTest.java | 14 ++ .../utils/DijkstraAlgorithmTest.java | 179 ++++++++++++++++++ .../shortestpath/AStarAlgorithm.class | Bin 3504 -> 1666 bytes .../shortestpath/DijkstraAlgorithm.class | Bin 7629 -> 5411 bytes .../org/insa/graphs/gui/simple/Launch.java | 2 + .../org/insa/graphs/gui/simple/Launch.class | Bin 2570 -> 2570 bytes 12 files changed, 213 insertions(+), 130 deletions(-) delete mode 100644 .vscode/launch.json delete mode 100644 be-graphes-algos/.classpath create mode 100644 be-graphes-algos/.settings/org.eclipse.jdt.apt.core.prefs create mode 100644 be-graphes-algos/src/test/java/org/insa/graphs/algorithm/utils/AStarAlgorithmTest.java create mode 100644 be-graphes-algos/src/test/java/org/insa/graphs/algorithm/utils/DijkstraAlgorithmTest.java diff --git a/.vscode/launch.json b/.vscode/launch.json deleted file mode 100644 index 1f4257f..0000000 --- a/.vscode/launch.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - // Use IntelliSense to learn about possible attributes. - // Hover to view descriptions of existing attributes. - // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 - "version": "0.2.0", - "configurations": [ - { - "type": "java", - "name": "Current File", - "request": "launch", - "mainClass": "${file}" - }, - { - "type": "java", - "name": "BinaryHeapFormatter", - "request": "launch", - "mainClass": "org.insa.graphs.algorithm.utils.BinaryHeapFormatter", - "projectName": "be-graphes-algos" - }, - { - "type": "java", - "name": "MainWindow", - "request": "launch", - "mainClass": "org.insa.graphs.gui.MainWindow", - "projectName": "be-graphes-gui" - }, - { - "type": "java", - "name": "Launch", - "request": "launch", - "mainClass": "org.insa.graphs.gui.simple.Launch", - "projectName": "be-graphes-gui" - } - ] -} \ No newline at end of file diff --git a/be-graphes-algos/.classpath b/be-graphes-algos/.classpath deleted file mode 100644 index 5e8a55f..0000000 --- a/be-graphes-algos/.classpath +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/be-graphes-algos/.settings/org.eclipse.jdt.apt.core.prefs b/be-graphes-algos/.settings/org.eclipse.jdt.apt.core.prefs new file mode 100644 index 0000000..d4313d4 --- /dev/null +++ b/be-graphes-algos/.settings/org.eclipse.jdt.apt.core.prefs @@ -0,0 +1,2 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.apt.aptEnabled=false diff --git a/be-graphes-algos/.settings/org.eclipse.jdt.core.prefs b/be-graphes-algos/.settings/org.eclipse.jdt.core.prefs index 2f5cc74..1b6e1ef 100644 --- a/be-graphes-algos/.settings/org.eclipse.jdt.core.prefs +++ b/be-graphes-algos/.settings/org.eclipse.jdt.core.prefs @@ -4,5 +4,6 @@ org.eclipse.jdt.core.compiler.compliance=1.8 org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=ignore +org.eclipse.jdt.core.compiler.processAnnotations=disabled org.eclipse.jdt.core.compiler.release=disabled org.eclipse.jdt.core.compiler.source=1.8 diff --git a/be-graphes-algos/src/main/java/org/insa/graphs/algorithm/shortestpath/AStarAlgorithm.java b/be-graphes-algos/src/main/java/org/insa/graphs/algorithm/shortestpath/AStarAlgorithm.java index a53c721..716a314 100644 --- a/be-graphes-algos/src/main/java/org/insa/graphs/algorithm/shortestpath/AStarAlgorithm.java +++ b/be-graphes-algos/src/main/java/org/insa/graphs/algorithm/shortestpath/AStarAlgorithm.java @@ -1,8 +1,6 @@ package org.insa.graphs.algorithm.shortestpath; import org.insa.graphs.model.Arc; import org.insa.graphs.model.Node; -import org.insa.graphs.model.Path; -import java.util.ArrayList; import org.insa.graphs.model.Point; public class AStarAlgorithm extends DijkstraAlgorithm { @@ -17,24 +15,5 @@ public class AStarAlgorithm extends DijkstraAlgorithm { return new LabelStar(x,cout,parent,Point.distance(data.getGraph().get(x.getId()).getPoint(), data.getDestination().getPoint())); } - @Override - public void ShortestVerif(ShortestPathSolution solution,ArrayList solutionNodes , ShortestPathData data) - { - Path p = Path.createShortestPathFromNodes(data.getGraph(), solutionNodes); - System.out.println("shortest path : " + p.getLength()); - if (p.getLength()-solution.getPath().getLength() < 1.00){ - System.out.println("le chemin Astar bien est le shortest"); - } - - } - - @Override - public void fastestVerif(ShortestPathSolution solution,ArrayList solutionNodes,ShortestPathData data){ - Path p= Path.createFastestPathFromNodes(data.getGraph(), solutionNodes); - System.out.println("fastest path : " + p.getMinimumTravelTime()); - if (p.getMinimumTravelTime()-solution.getPath().getMinimumTravelTime() < 1.00){ - System.out.println("le chemin Astar est bien le fastest"); - } - - } + } diff --git a/be-graphes-algos/src/main/java/org/insa/graphs/algorithm/shortestpath/DijkstraAlgorithm.java b/be-graphes-algos/src/main/java/org/insa/graphs/algorithm/shortestpath/DijkstraAlgorithm.java index 226c8ea..6b02464 100644 --- a/be-graphes-algos/src/main/java/org/insa/graphs/algorithm/shortestpath/DijkstraAlgorithm.java +++ b/be-graphes-algos/src/main/java/org/insa/graphs/algorithm/shortestpath/DijkstraAlgorithm.java @@ -8,7 +8,6 @@ import org.insa.graphs.algorithm.utils.BinaryHeap; import org.insa.graphs.model.Arc; import org.insa.graphs.model.Node; import org.insa.graphs.model.Path; -import org.insa.graphs.model.Point; public class DijkstraAlgorithm extends ShortestPathAlgorithm { @@ -29,7 +28,6 @@ public class DijkstraAlgorithm extends ShortestPathAlgorithm { ArrayList