create changelog entry
[debian/openrocket] / core / test / net / sf / openrocket / models / gravity / WGSGravityModelTest.java
1 package net.sf.openrocket.models.gravity;
2
3 import static org.junit.Assert.assertEquals;
4 import net.sf.openrocket.util.WorldCoordinate;
5
6 import org.junit.Test;
7
8
9 public class WGSGravityModelTest {
10         
11         private WGSGravityModel model = new WGSGravityModel();
12         
13         @Test
14         public void testSurfaceGravity() {
15                 // Equator
16                 test(0, 0, 0, 9.780);
17                 // Mid-latitude
18                 test(45, 0, 0, 9.806);
19                 // Mid-latitude
20                 test(45, 99, 0, 9.806);
21                 // South pole
22                 test(-90, 0, 0, 9.832);
23         }
24         
25         @Test
26         public void testAltitudeEffect() {
27                 test(45, 0, -100, 9.806);
28                 test(45, 0, 0, 9.806);
29                 test(45, 0, 10, 9.806);
30                 test(45, 0, 100, 9.806);
31                 test(45, 0, 1000, 9.803);
32                 test(45, 0, 10000, 9.775);
33                 test(45, 0, 100000, 9.505);
34         }
35         
36         private void test(double lat, double lon, double alt, double g) {
37                 WorldCoordinate wc = new WorldCoordinate(lat, lon, alt);
38                 assertEquals(g, model.getGravity(wc), 0.001);
39                 assertEquals(g, model.getGravity(wc), 0.001);
40         }
41         
42 }