示例#1
0
 def test_unpack_message_format(self):
     message = "00000000000001.00: 0xffffff, 0xffffffff;"
     expected = ("00000000000001.00", "0xffffff", "0xffffffff")
     self.assertTupleEqual(expected, ModeSReply().unpack(message))
示例#2
0
 def test_2bit_downlink_format(self):
     # format 24 when when the first two bits are '11'
     data = Bits('0b11') + Bits(length=(83 - 2))
     reply = ModeSReply(data=data)
     self.assertEqual(24, reply.format)
示例#3
0
 def test_data_length(self):
     data = Bits(length=83)
     reply = ModeSReply(data=data)
     self.assertEqual(83, reply.length)
示例#4
0
 def test_instance_from_message(self):
     message = "00000000000001.00: 0xffffff, 0xffffffff;"
     reply = ModeSReply.from_message(message)
     self.assertEqual(1.00, reply.timestamp)
     self.assertEqual(Bits('0xffffff'), reply.icao)
     self.assertEqual(Bits('0xffffffff'), reply.data)
示例#5
0
 def test_5bit_downlink_format(self):
     # formats 0 to 23
     data = Bits('0b00001') + Bits(length=(83 - 5))
     reply = ModeSReply(data=data)
     self.assertEqual(1, reply.format)
示例#6
0
 def test_parse_icao_number(self):
     icao_text = '0x111111'
     icao = ModeSReply.parse_icao(icao_text)
     self.assertEqual(Bits('0x111111'), icao)
示例#7
0
 def test_parse_data(self):
     data_text = '0x00000000'
     data = ModeSReply.parse_data(data_text)
     self.assertEqual(Bits('0x00000000'), data)
示例#8
0
 def test_parse_timestamp(self):
     stamp_text = "00000000506733.25"
     timestamp = ModeSReply.parse_timestamp(stamp_text)
     self.assertEqual(506733.25, timestamp)
示例#9
0
文件: test.py 项目: jesse-/modeSmon
 def test_instance_from_message(self):
     message = "00000000000001.00: 0xffffff, 0xffffffff;"
     reply = ModeSReply.from_message(message)
     self.assertEqual(1.00, reply.timestamp)
     self.assertEqual(Bits('0xffffff'), reply.icao)
     self.assertEqual(Bits('0xffffffff'), reply.data)
示例#10
0
文件: test.py 项目: jesse-/modeSmon
 def test_parse_data(self):
     data_text = '0x00000000'
     data = ModeSReply.parse_data(data_text)
     self.assertEqual(Bits('0x00000000'), data)
示例#11
0
文件: test.py 项目: jesse-/modeSmon
 def test_parse_icao_number(self):
     icao_text = '0x111111'
     icao = ModeSReply.parse_icao(icao_text)
     self.assertEqual(Bits('0x111111'), icao)
示例#12
0
文件: test.py 项目: jesse-/modeSmon
 def test_parse_timestamp(self):
     stamp_text = "00000000506733.25"
     timestamp = ModeSReply.parse_timestamp(stamp_text)
     self.assertEqual(506733.25, timestamp)