From 4db502c8cadd83640a49d7e5f5c35f17d6d78496 Mon Sep 17 00:00:00 2001 From: sakimotor Date: Mon, 11 Mar 2024 17:00:43 +0100 Subject: [PATCH] GPS distance tests --- .../fr/u_paris/gla/project/utils/GPSTest.java | 39 +++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 src/test/java/fr/u_paris/gla/project/utils/GPSTest.java diff --git a/src/test/java/fr/u_paris/gla/project/utils/GPSTest.java b/src/test/java/fr/u_paris/gla/project/utils/GPSTest.java new file mode 100644 index 0000000..de63357 --- /dev/null +++ b/src/test/java/fr/u_paris/gla/project/utils/GPSTest.java @@ -0,0 +1,39 @@ +package fr.u_paris.gla.project.utils; + +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.*; + +class GPSTest { + + + @Test + void distance_SameLat(){ + assertDoesNotThrow( + () -> { + GPS.distance(5, 3, 5, 11); + } + ); + } + + @Test + void distance_SameLon(){ + assertDoesNotThrow( + () -> { + GPS.distance(5, 3, 7, 3); + } + ); + } + + @Test + void distance_SamePoint() { + assertEquals(0.0, GPS.distance(5, 3, 5, 3) ); + } + + @Test + void distance_NegativePoint(){ + assertNotEquals(0.0, GPS.distance(-5, 7, -13, 4)); + } + + +} \ No newline at end of file