1 package net.sf.openrocket.models.gravity;
3 import static org.junit.Assert.assertEquals;
4 import net.sf.openrocket.util.WorldCoordinate;
9 public class WGSGravityModelTest {
11 private WGSGravityModel model = new WGSGravityModel();
14 public void testSurfaceGravity() {
18 test(45, 0, 0, 9.806);
20 test(45, 99, 0, 9.806);
22 test(-90, 0, 0, 9.832);
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);
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);