[test] Fix non working test
This commit is contained in:
parent
9716f3e64d
commit
6ecff939ef
1 changed files with 5 additions and 5 deletions
|
@ -99,22 +99,22 @@ public class CSVStreamProviderTest {
|
|||
@Test
|
||||
public void testDistanceToTime() throws Exception {
|
||||
// Valeurs fictives pour TWO_ACCELERATION_DISTANCE et MAX_SPEED
|
||||
final double TWO_ACCELERATION_DISTANCE = 0.1; // Par exemple
|
||||
final double MAX_SPEED = 10.0; // Par exemple
|
||||
final double TWO_ACCELERATION_DISTANCE = 0.1;
|
||||
final double MAX_SPEED = 10.0;
|
||||
|
||||
// Exemple de distance à tester
|
||||
double distanceExample = 1.0; // 1 km
|
||||
|
||||
// Calcul attendu basé sur la formule fournie
|
||||
double expected = Math.max(0, distanceExample - TWO_ACCELERATION_DISTANCE) / MAX_SPEED
|
||||
+ Math.pow(Math.min(distanceExample, TWO_ACCELERATION_DISTANCE) / MAX_SPEED, 2);
|
||||
+ (2 * Math.sqrt(Math.min(distanceExample, TWO_ACCELERATION_DISTANCE) * TWO_ACCELERATION_DISTANCE) / MAX_SPEED);
|
||||
|
||||
// Accès à la méthode distanceToTime via la réflexion
|
||||
Method method = CSVStreamProvider.class.getDeclaredMethod("distanceToTime", double.class,String.class);
|
||||
Method method = CSVStreamProvider.class.getDeclaredMethod("distanceToTime", double.class, String.class);
|
||||
method.setAccessible(true);
|
||||
|
||||
// Invocation de la méthode distanceToTime et stockage du résultat
|
||||
double result = (Double) method.invoke(null, distanceExample,"Bus");
|
||||
double result = (Double) method.invoke(null, distanceExample, "Bus");
|
||||
|
||||
// Assertion pour vérifier si le résultat est conforme à l'attendu
|
||||
assertEquals(expected, result, "Le calcul du temps à partir de la distance devrait être conforme à l'attendu.");
|
||||
|
|
Reference in a new issue