create changelog entry
[debian/openrocket] / core / test / net / sf / openrocket / util / WorldCoordinateTest.java
1 package net.sf.openrocket.util;
2
3 import static org.junit.Assert.assertEquals;
4
5 import org.junit.Test;
6
7 public class WorldCoordinateTest {
8         
9         private static final double EPS = 1e-10;
10         
11         @Test
12         public void testConstructor() {
13                 WorldCoordinate wc;
14                 
15                 wc = new WorldCoordinate(10, 15, 130);
16                 assertEquals(10, wc.getLatitudeDeg(), EPS);
17                 assertEquals(15, wc.getLongitudeDeg(), EPS);
18                 assertEquals(130, wc.getAltitude(), 0);
19                 
20                 wc = new WorldCoordinate(100, 190, 13000);
21                 assertEquals(90, wc.getLatitudeDeg(), EPS);
22                 assertEquals(-170, wc.getLongitudeDeg(), EPS);
23                 assertEquals(13000, wc.getAltitude(), 0);
24                 
25                 wc = new WorldCoordinate(-100, -200, -13000);
26                 assertEquals(-90, wc.getLatitudeDeg(), EPS);
27                 assertEquals(160, wc.getLongitudeDeg(), EPS);
28                 assertEquals(-13000, wc.getAltitude(), 0);
29         }
30         
31         @Test
32         public void testGetLatitude() {
33                 WorldCoordinate wc;
34                 wc = new WorldCoordinate(10, 15, 130);
35                 assertEquals(10, wc.getLatitudeDeg(), EPS);
36                 assertEquals(Math.toRadians(10), wc.getLatitudeRad(), EPS);
37         }
38         
39         @Test
40         public void testGetLongitude() {
41                 WorldCoordinate wc;
42                 wc = new WorldCoordinate(10, 15, 130);
43                 assertEquals(15, wc.getLongitudeDeg(), EPS);
44                 assertEquals(Math.toRadians(15), wc.getLongitudeRad(), EPS);
45         }
46         
47 }