예제 #1
0
 def test_Pack(self):
     bytes = [255, 0, 0, 0, 0, 0, 0, 0, 0]
     expectedresult = np.array([
         0x00, 0x08, 0x01, 0x00, 0x20, 0x04, 0x02, 0x00, 0x10, 0x08, 0x01,
         0x00
     ])
     result = jts.bytestojt65(bytes)
     self.assertEqual(len(result), len(expectedresult))
     self.assertEqual(result.tolist(), expectedresult.tolist())
예제 #2
0
 def test_PackUnpack(self):
     for i in range(RANDOM_TEST_LOOP_COUNT):
         randomJT65bytes = np.array(
             [random.randint(0, JT65_MAX_SYMBOL) for r in range(12)])
         byteresult = jts.jt65tobytes(randomJT65bytes)
         jt65result = jts.bytestojt65(byteresult)
         self.assertEqual(len(byteresult), 9)
         self.assertEqual(len(jt65result), 12)
         self.assertEqual(jt65result.tolist(), randomJT65bytes.tolist())
예제 #3
0
 def test_UnpackNegative(self):
     for i in range(RANDOM_TEST_LOOP_COUNT):
         randombytes = np.array([random.randint(0, 0xFF) for r in range(9)])
         jt65result = jts.bytestojt65(randombytes)
         self.assertNotEqual(jt65result.tolist(), randombytes.tolist())