Test à corriger

This commit is contained in:
Marie Brunetto 2023-04-19 18:21:01 +02:00
parent 41f1b62d26
commit bbc51ce00b

View file

@ -1,7 +1,7 @@
package org.insa.graphs.algorithm.utils;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.assertFalse;
import java.util.ArrayList;
@ -58,7 +58,7 @@ public class PCCTest{
arcInspectors.add(ArcInspectorFactory.getAllFilters().get(0)) ; //Sans Filtres
arcInspectors.add(ArcInspectorFactory.getAllFilters().get(1)); //Voiture, longueur
arcInspectors.add(ArcInspectorFactory.getAllFilters().get(2)); //Voiture, temps
arcInspectors.add(ArcInspectorFactory.getAllFilters().get(3)); //Voiture, temps
//Créations des données pour les algos
@ -95,7 +95,8 @@ public class PCCTest{
public void TestDikjstraVL() {
dji = new DijkstraAlgorithm(DataVL_INSA);
assertTrue(dji.run().isFeasible());
assertFalse(dji.run().isFeasible());
dji = new DijkstraAlgorithm(DataVL_HauteGaronne);
bf = new BellmanFordAlgorithm(DataVL_HauteGaronne);
@ -107,14 +108,14 @@ public class PCCTest{
@Test
public void TestDikjstraVT() {
dji = new DijkstraAlgorithm(DataVT_INSA);
bf = new BellmanFordAlgorithm(DataVT_INSA);
assertEquals(bf.run().getPath().getLength(), dji.run().getPath().getLength(), 0.05f);
dji = new DijkstraAlgorithm(DataVL_INSA);
assertFalse(dji.run().isFeasible());
dji = new DijkstraAlgorithm(DataVT_HauteGaronne);
bf = new BellmanFordAlgorithm(DataVT_HauteGaronne);
assertEquals(bf.run().getPath().getLength(), dji.run().getPath().getLength(), 0.05f);
assertEquals(bf.run().getPath().getMinimumTravelTime(), dji.run().getPath().getMinimumTravelTime(), 0.05f);
}
@ -135,7 +136,7 @@ public class PCCTest{
public void TestAStarVL() {
as = new AStarAlgorithm(DataVL_INSA);
assertTrue(as.run().isFeasible());
assertFalse(as.run().isFeasible());
as = new AStarAlgorithm(DataVL_HauteGaronne);
bf = new BellmanFordAlgorithm(DataVL_HauteGaronne);
@ -148,12 +149,11 @@ public class PCCTest{
public void TestAStarVT() {
as = new AStarAlgorithm(DataVT_INSA);
bf = new BellmanFordAlgorithm(DataVT_INSA);
assertEquals(bf.run().getPath().getLength(), as.run().getPath().getLength(), 0.05f);
assertFalse(as.run().isFeasible());
as = new AStarAlgorithm(DataVT_HauteGaronne);
bf = new BellmanFordAlgorithm(DataVT_HauteGaronne);
assertEquals(bf.run().getPath().getLength(), as.run().getPath().getLength(), 0.05f);
assertEquals(bf.run().getPath().getMinimumTravelTime(), as.run().getPath().getMinimumTravelTime(), 0.05f);
}