-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #42 from terminal2/improve-bds-60-decoding
Improve BDS60 decoding real messages can contain larger gaps in IRS /…
- Loading branch information
Showing
3 changed files
with
44 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
src/test/java/aero/t2s/modes/decoder/df/DfRealMessageTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package aero.t2s.modes.decoder.df; | ||
|
||
import aero.t2s.modes.BinaryHelper; | ||
import aero.t2s.modes.database.ModeSDatabase; | ||
import aero.t2s.modes.decoder.Decoder; | ||
import aero.t2s.modes.decoder.UnknownDownlinkFormatException; | ||
import aero.t2s.modes.decoder.df.bds.Bds60; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import java.util.HashMap; | ||
import static org.junit.jupiter.api.Assertions.*; | ||
|
||
public class DfRealMessageTest { | ||
@Test | ||
public void test_bds60() throws UnknownDownlinkFormatException { | ||
DownlinkFormat df = testMessage("A0001838E71A21357F640110A153"); | ||
|
||
assertInstanceOf(DF20.class, df); | ||
|
||
assertTrue(((DF20)df).isValid()); | ||
assertFalse(((DF20)df).isMultipleMatches()); | ||
assertInstanceOf(Bds60.class, ((DF20)df).getBds()); | ||
assertEquals(38000, ((DF20) df).getAltitude().getAltitude()); | ||
|
||
Bds60 bds = (Bds60) ((DF20)df).getBds(); | ||
assertTrue(bds.isStatusMagneticHeading()); | ||
assertEquals(289.863, bds.getMagneticHeading(), 0.001); | ||
assertTrue(bds.isStatusIas()); | ||
assertEquals(272, bds.getIas()); | ||
assertTrue(bds.isStatusMach()); | ||
assertEquals(0.852, bds.getMach()); | ||
assertTrue(bds.isStatusBaroRocd()); | ||
assertEquals(-640, bds.getBaroRocd()); | ||
assertTrue(bds.isStatusIrsRocd()); | ||
assertEquals(32, bds.getIrsRocd()); | ||
} | ||
|
||
private DownlinkFormat testMessage(String message) throws UnknownDownlinkFormatException { | ||
Decoder decoder = new Decoder(new HashMap<>(), 50, 2, ModeSDatabase.createDatabase()); | ||
|
||
return decoder.decode(BinaryHelper.stringToByteArray(message)); | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.