update test procedue in Makefile

pull/83/head
Junzi Sun 4 years ago
parent 2085a2c432
commit ba84cd7c39

@ -8,6 +8,12 @@ ext:
python setup.py build_ext --inplace
test:
make clean
@echo ""
@echo "[Test with py_common]"
python -m pytest tests
@echo ""
@echo "[Test with c_common]"
python setup.py build_ext --inplace
python -m pytest tests

@ -1,13 +1,12 @@
from pyModeS import c_common
try:
from pyModeS import c_common
def test_conversions():
def test_conversions():
assert c_common.hex2bin("6E") == "01101110"
assert c_common.bin2hex("01101110") == "6E"
assert c_common.bin2hex("1101110") == "6E"
def test_crc_decode():
def test_crc_decode():
assert c_common.crc("8D406B902015A678D4D220AA4BDA") == 0
assert c_common.crc("8d8960ed58bf053cf11bc5932b7d") == 0
@ -23,28 +22,23 @@ def test_crc_decode():
assert c_common.crc("8d4ca251204994b1c36e60a5343d") == 16
assert c_common.crc("b0001718c65632b0a82040715b65") == 353333
def test_crc_encode():
def test_crc_encode():
parity = c_common.crc("8D406B902015A678D4D220AA4BDA", encode=True)
assert parity == 11160538
def test_icao():
def test_icao():
assert c_common.icao("8D406B902015A678D4D220AA4BDA") == "406B90"
assert c_common.icao("A0001839CA3800315800007448D9") == "400940"
assert c_common.icao("A000139381951536E024D4CCF6B5") == "3C4DD2"
assert c_common.icao("A000029CFFBAA11E2004727281F1") == "4243D0"
def test_modes_altcode():
def test_modes_altcode():
assert c_common.altcode("A02014B400000000000000F9D514") == 32300
def test_modes_idcode():
def test_modes_idcode():
assert c_common.idcode("A800292DFFBBA9383FFCEB903D01") == "1346"
def test_graycode_to_altitude():
def test_graycode_to_altitude():
assert c_common.gray2alt("00000000010") == -1000
assert c_common.gray2alt("00000001010") == -500
assert c_common.gray2alt("00000011011") == -100
@ -60,3 +54,7 @@ def test_graycode_to_altitude():
assert c_common.gray2alt("11011110100") == 73200
assert c_common.gray2alt("10000000011") == 126600
assert c_common.gray2alt("10000000001") == 126700
except:
pass

Loading…
Cancel
Save