update test
This commit is contained in:
+1
-1
@@ -6,7 +6,7 @@ __pycache__/
|
|||||||
.pytest_cache/
|
.pytest_cache/
|
||||||
|
|
||||||
#cython
|
#cython
|
||||||
.c
|
*.c
|
||||||
|
|
||||||
# C extensions
|
# C extensions
|
||||||
*.so
|
*.so
|
||||||
|
|||||||
@@ -1,10 +1,9 @@
|
|||||||
|
try:
|
||||||
from pyModeS.decoder import c_common as common
|
from pyModeS.decoder import c_common as common
|
||||||
|
|
||||||
|
|
||||||
def test_conversions():
|
def test_conversions():
|
||||||
assert common.hex2bin("6E406B") == "011011100100000001101011"
|
assert common.hex2bin("6E406B") == "011011100100000001101011"
|
||||||
|
|
||||||
|
|
||||||
def test_crc_decode():
|
def test_crc_decode():
|
||||||
|
|
||||||
assert common.crc("8D406B902015A678D4D220AA4BDA") == 0
|
assert common.crc("8D406B902015A678D4D220AA4BDA") == 0
|
||||||
@@ -21,27 +20,22 @@ def test_crc_decode():
|
|||||||
assert common.crc("8d4ca251204994b1c36e60a5343d") == 16
|
assert common.crc("8d4ca251204994b1c36e60a5343d") == 16
|
||||||
assert common.crc("b0001718c65632b0a82040715b65") == 353333
|
assert common.crc("b0001718c65632b0a82040715b65") == 353333
|
||||||
|
|
||||||
|
|
||||||
def test_crc_encode():
|
def test_crc_encode():
|
||||||
parity = common.crc("8D406B902015A678D4D220AA4BDA", encode=True)
|
parity = common.crc("8D406B902015A678D4D220AA4BDA", encode=True)
|
||||||
assert parity == 11160538
|
assert parity == 11160538
|
||||||
|
|
||||||
|
|
||||||
def test_icao():
|
def test_icao():
|
||||||
assert common.icao("8D406B902015A678D4D220AA4BDA") == "406B90"
|
assert common.icao("8D406B902015A678D4D220AA4BDA") == "406B90"
|
||||||
assert common.icao("A0001839CA3800315800007448D9") == "400940"
|
assert common.icao("A0001839CA3800315800007448D9") == "400940"
|
||||||
assert common.icao("A000139381951536E024D4CCF6B5") == "3C4DD2"
|
assert common.icao("A000139381951536E024D4CCF6B5") == "3C4DD2"
|
||||||
assert common.icao("A000029CFFBAA11E2004727281F1") == "4243D0"
|
assert common.icao("A000029CFFBAA11E2004727281F1") == "4243D0"
|
||||||
|
|
||||||
|
|
||||||
def test_modes_altcode():
|
def test_modes_altcode():
|
||||||
assert common.altcode("A02014B400000000000000F9D514") == 32300
|
assert common.altcode("A02014B400000000000000F9D514") == 32300
|
||||||
|
|
||||||
|
|
||||||
def test_modes_idcode():
|
def test_modes_idcode():
|
||||||
assert common.idcode("A800292DFFBBA9383FFCEB903D01") == "1346"
|
assert common.idcode("A800292DFFBBA9383FFCEB903D01") == "1346"
|
||||||
|
|
||||||
|
|
||||||
def test_graycode_to_altitude():
|
def test_graycode_to_altitude():
|
||||||
assert common.gray2alt("00000000010") == -1000
|
assert common.gray2alt("00000000010") == -1000
|
||||||
assert common.gray2alt("00000001010") == -500
|
assert common.gray2alt("00000001010") == -500
|
||||||
@@ -58,3 +52,7 @@ def test_graycode_to_altitude():
|
|||||||
assert common.gray2alt("11011110100") == 73200
|
assert common.gray2alt("11011110100") == 73200
|
||||||
assert common.gray2alt("10000000011") == 126600
|
assert common.gray2alt("10000000011") == 126600
|
||||||
assert common.gray2alt("10000000001") == 126700
|
assert common.gray2alt("10000000001") == 126700
|
||||||
|
|
||||||
|
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|||||||
Reference in New Issue
Block a user