Skip to content

Commit 0a7ff3e

Browse files
authored
Added LocationUtilsTest for LocationUtils (commons-app#4319)
* added location utils test * requested changes
1 parent 0d23e65 commit 0a7ff3e

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
package fr.free.nrw.commons.utils
2+
3+
import fr.free.nrw.commons.location.LatLng
4+
import org.junit.Test
5+
import org.junit.jupiter.api.Assertions.assertEquals
6+
7+
/**
8+
* Test class for location utils
9+
*/
10+
class LocationUtilsTest {
11+
12+
/**
13+
* MapBox LatLng to commons LatLng test.
14+
*/
15+
@Test
16+
fun testMapBoxLatLngToCommonsLatLng() {
17+
val commonsLatLngTest = LocationUtils.mapBoxLatLngToCommonsLatLng(com.mapbox.mapboxsdk.geometry.LatLng(0.0, 0.0))
18+
assertEquals(0.0, commonsLatLngTest.latitude)
19+
assertEquals(0.0, commonsLatLngTest.longitude)
20+
assertEquals(0f, commonsLatLngTest.accuracy)
21+
}
22+
23+
/**
24+
* Commons LatLng to MapBox LatLng test.
25+
*/
26+
@Test
27+
fun testCommonsLatLngToMapBoxLatLng() {
28+
val geoLatLngTest = LocationUtils.commonsLatLngToMapBoxLatLng(LatLng(0.0, 0.0, 0f))
29+
assertEquals(0.0, geoLatLngTest.latitude)
30+
assertEquals(0.0, geoLatLngTest.longitude)
31+
assertEquals(0.0, geoLatLngTest.altitude)
32+
}
33+
34+
}

0 commit comments

Comments
 (0)