Skip to content

Commit

Permalink
Allow floating point leeway
Browse files Browse the repository at this point in the history
  • Loading branch information
Douglasdc3 committed Mar 12, 2023
1 parent 85848d7 commit b94606b
Showing 1 changed file with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@

import java.util.HashMap;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertInstanceOf;
import static org.junit.jupiter.api.Assertions.*;

class AirbornePositionTest {
@Test
Expand All @@ -27,7 +26,7 @@ public void test_airborne_position_aircraft() throws UnknownDownlinkFormatExcept
assertInstanceOf(AirbornePosition.class, exSqA);
AirbornePosition positionA = (AirbornePosition) exSqA;
// We should NOT have a valid position after only one frame
assertEquals(false, positionA.isPositionAvailable());
assertFalse(positionA.isPositionAvailable());

// This is an EVEN frame with Surface Position
DownlinkFormat dfB = testMessage("8d407663588303313d84f719b2de");
Expand All @@ -39,9 +38,10 @@ public void test_airborne_position_aircraft() throws UnknownDownlinkFormatExcept
assertInstanceOf(AirbornePosition.class, exSqB);
AirbornePosition positionB = (AirbornePosition) exSqB;
// We should now have a valid position after receiving both even and odd frames
assertEquals(true, positionB.isPositionAvailable());
assertEquals(52.789, positionB.getLat(), 0.001);
assertEquals(-2.405, positionB.getLon(), 0.001);

assertTrue(positionB.isPositionAvailable());
assertEquals(52.789, positionB.getLat(), 0.01);
assertEquals(-2.405, positionB.getLon(), 0.01);
}

private DownlinkFormat testMessage(String message) throws UnknownDownlinkFormatException {
Expand Down

0 comments on commit b94606b

Please sign in to comment.