summaryrefslogtreecommitdiff
path: root/platform/android/MapboxGLAndroidSDKTestApp/src/test/java/com/mapbox/mapboxsdk/maps/CoordinateSpanTest.java
blob: f30ff8df26da8f7e5472bb1bb2a88203377489dc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
package com.mapbox.mapboxsdk.maps;

import com.mapbox.mapboxsdk.geometry.CoordinateSpan;

import org.junit.Test;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;

public class CoordinateSpanTest {

    private static final double DELTA = 1e-15;

    @Test
    public void testSanity() {
        CoordinateSpan coordinateSpan = new CoordinateSpan(0.0, 0.0);
        assertNotNull("coordinateSpan should not be null", coordinateSpan);
    }

    @Test
    public void testLatitudeConstructor() {
        double latitude = 1.23;
        CoordinateSpan coordinateSpan = new CoordinateSpan(latitude, 0.0);
        assertEquals("latitude in constructor", coordinateSpan.getLatitudeSpan(), latitude, DELTA);
    }

    @Test
    public void testLongitudeConstructor() {
        double longitude = 1.23;
        CoordinateSpan coordinateSpan = new CoordinateSpan(0.0, longitude);
        assertEquals("latitude in constructor", coordinateSpan.getLongitudeSpan(), longitude, DELTA);
    }

    @Test
    public void testLatitudeMethod() {
        double latitude = 1.23;
        CoordinateSpan coordinateSpan = new CoordinateSpan(0.0, 0.0);
        coordinateSpan.setLatitudeSpan(latitude);
        assertEquals("latitude in constructor", coordinateSpan.getLatitudeSpan(), latitude, DELTA);
    }

    @Test
    public void testLongitudeMethod() {
        double longitude = 1.23;
        CoordinateSpan coordinateSpan = new CoordinateSpan(0.0, 0.0);
        coordinateSpan.setLongitudeSpan(longitude);
        assertEquals("latitude in constructor", coordinateSpan.getLongitudeSpan(), longitude, DELTA);
    }

}