From 0a7ff3e068708fa7263780c6f41d2d2512dd9170 Mon Sep 17 00:00:00 2001 From: Aditya-Srivastav <54016427+4D17Y4@users.noreply.github.com> Date: Thu, 8 Apr 2021 18:10:28 +0530 Subject: [PATCH] Added LocationUtilsTest for LocationUtils (#4319) * added location utils test * requested changes --- .../nrw/commons/utils/LocationUtilsTest.kt | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 app/src/test/kotlin/fr/free/nrw/commons/utils/LocationUtilsTest.kt diff --git a/app/src/test/kotlin/fr/free/nrw/commons/utils/LocationUtilsTest.kt b/app/src/test/kotlin/fr/free/nrw/commons/utils/LocationUtilsTest.kt new file mode 100644 index 000000000..7d1da2791 --- /dev/null +++ b/app/src/test/kotlin/fr/free/nrw/commons/utils/LocationUtilsTest.kt @@ -0,0 +1,34 @@ +package fr.free.nrw.commons.utils + +import fr.free.nrw.commons.location.LatLng +import org.junit.Test +import org.junit.jupiter.api.Assertions.assertEquals + +/** + * Test class for location utils + */ +class LocationUtilsTest { + + /** + * MapBox LatLng to commons LatLng test. + */ + @Test + fun testMapBoxLatLngToCommonsLatLng() { + val commonsLatLngTest = LocationUtils.mapBoxLatLngToCommonsLatLng(com.mapbox.mapboxsdk.geometry.LatLng(0.0, 0.0)) + assertEquals(0.0, commonsLatLngTest.latitude) + assertEquals(0.0, commonsLatLngTest.longitude) + assertEquals(0f, commonsLatLngTest.accuracy) + } + + /** + * Commons LatLng to MapBox LatLng test. + */ + @Test + fun testCommonsLatLngToMapBoxLatLng() { + val geoLatLngTest = LocationUtils.commonsLatLngToMapBoxLatLng(LatLng(0.0, 0.0, 0f)) + assertEquals(0.0, geoLatLngTest.latitude) + assertEquals(0.0, geoLatLngTest.longitude) + assertEquals(0.0, geoLatLngTest.altitude) + } + +} \ No newline at end of file