Added LocationUtilsTest for LocationUtils (#4319)

* added location utils test

* requested changes
This commit is contained in:
Aditya-Srivastav 2021-04-08 18:10:28 +05:30 committed by GitHub
parent 0d23e65e0f
commit 0a7ff3e068
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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)
}
}