Ejemplo n.º 1
0
 def test_decode_shortint(self):
     input = (
             b'\x00\x00\x00\x01'
             b'\x08shortints\x04\xd2'
         )
     result = data.decode_table(input, 0)
     self.assertEqual(result, ({'shortint': 1234}, 16))
Ejemplo n.º 2
0
 def test_decode_bytes(self):
     input = (
             b'\x00\x00\x00\x01'
             b'\x05bytesx\x00\x00\x00\x06foobar'
         )
     result = data.decode_table(input, 0)
     self.assertEqual(result, ({'bytes': b'foobar'}, 21))
Ejemplo n.º 3
0
 def test_decode_bytes(self):
     input = (
             b'\x00\x00\x00\x01'
             b'\x05bytesx\x00\x00\x00\x06foobar'
         )
     result = data.decode_table(input, 0)
     self.assertEqual(result, ({'bytes': b'foobar'}, 21))
Ejemplo n.º 4
0
 def test_decode_table_bytes(self):
     value, byte_count = data.decode_table(self.FIELD_TBL_ENCODED, 0)
     self.assertEqual(byte_count, len(self.FIELD_TBL_ENCODED))
Ejemplo n.º 5
0
 def test_decode_table(self):
     value, byte_count = data.decode_table(self.FIELD_TBL_ENCODED, 0)
     self.assertDictEqual(value, self.FIELD_TBL_VALUE)
Ejemplo n.º 6
0
 def test_decode_table_bytes(self):
     value, byte_count = data.decode_table(self.FIELD_TBL_ENCODED, 0)
     self.assertEqual(byte_count, 191)
Ejemplo n.º 7
0
 def test_decode_table(self):
     value, byte_count = data.decode_table(self.FIELD_TBL_ENCODED, 0)
     self.assertDictEqual(value, self.FIELD_TBL_VALUE)