Example #1
0
 def test_convert_two_byte_int(self):
     in_bytes = b'\x00\x00\x00\x01\x00\x02\x00\x01\x00\x00\x00\x00\x00\x00\x00\x02'
     out_array_test = [0, 1, 2, 1, 0, 0, 0, 2]
     self.assertEqual(
         out_array_test,
         converters.convert_bytes_to_ints(in_bytes, 2).tolist())
     self.assertEqual(in_bytes,
                      converters.convert_ints_to_bytes(out_array_test, 2))
     self.assertEqual(
         in_bytes,
         converters.convert_ints_to_bytes(
             converters.convert_bytes_to_ints(in_bytes, 2), 2))
Example #2
0
 def test_convert_four_byte_int(self):
     in_bytes = b'\x00\x00\x00\x01\x00\x02\x00\x01\x00\x00\x00\x00\x00\x00\x00\x02'
     out_array_test = [1, 131073, 0, 2]
     self.assertEqual(
         out_array_test,
         converters.convert_bytes_to_ints(in_bytes, 4).tolist())
     self.assertEqual(in_bytes,
                      converters.convert_ints_to_bytes(out_array_test, 4))
     self.assertEqual(
         in_bytes,
         converters.convert_ints_to_bytes(
             converters.convert_bytes_to_ints(in_bytes, 4), 4))
Example #3
0
 def test_convert_one_byte_int(self):
     in_bytes = b'\x07\x06\x06\x07\x07'
     out_array_test = [7, 6, 6, 7, 7]
     self.assertEqual(
         out_array_test,
         converters.convert_bytes_to_ints(in_bytes, 1).tolist())
     self.assertEqual(in_bytes,
                      converters.convert_ints_to_bytes(out_array_test, 1))
     self.assertEqual(
         in_bytes,
         converters.convert_ints_to_bytes(
             converters.convert_bytes_to_ints(in_bytes, 1), 1))
Example #4
0
 def test_convert_four_byte_int(self):
     in_bytes = b'\x00\x00\x00\x01\x00\x02\x00\x01\x00\x00\x00\x00\x00\x00\x00\x02'
     out_array_test = [1, 131073, 0, 2]
     self.assertEqual(out_array_test, converters.convert_bytes_to_ints(in_bytes,4).tolist())
     self.assertEqual(in_bytes, converters.convert_ints_to_bytes(out_array_test,4))
     self.assertEqual(in_bytes,converters.convert_ints_to_bytes(converters.convert_bytes_to_ints(in_bytes,4),4))
Example #5
0
 def test_convert_two_byte_int(self):
     in_bytes = b'\x00\x00\x00\x01\x00\x02\x00\x01\x00\x00\x00\x00\x00\x00\x00\x02'
     out_array_test = [0,1,2,1,0,0,0,2]
     self.assertEqual(out_array_test, converters.convert_bytes_to_ints(in_bytes,2).tolist())
     self.assertEqual(in_bytes, converters.convert_ints_to_bytes(out_array_test, 2))
     self.assertEqual(in_bytes,converters.convert_ints_to_bytes(converters.convert_bytes_to_ints(in_bytes,2),2))
Example #6
0
 def test_convert_one_byte_int(self):
     in_bytes = b'\x07\x06\x06\x07\x07'
     out_array_test = [7,6,6,7,7]
     self.assertEqual(out_array_test, converters.convert_bytes_to_ints(in_bytes,1).tolist())
     self.assertEqual(in_bytes, converters.convert_ints_to_bytes(out_array_test,1))
     self.assertEqual(in_bytes,converters.convert_ints_to_bytes(converters.convert_bytes_to_ints(in_bytes,1),1))
Example #7
0
 def decode(in_array, param):
     return converters.convert_ints_to_floats(
         delta_decode(
             converters.recursive_index_decode(
                 converters.convert_bytes_to_ints(in_array,2))),param)
Example #8
0
 def decode(in_array,param):
     return converters.convert_bytes_to_ints(in_array, 4)
Example #9
0
 def decode(in_array, param):
     return converters.convert_ints_to_chars(
         run_length_decode(
             converters.convert_bytes_to_ints(in_array, 4)))
Example #10
0
 def decode(in_array, param):
     return delta_decode(
         run_length_decode(
             converters.convert_bytes_to_ints(in_array, 4)))
Example #11
0
 def decode(in_array, param):
     return converters.convert_bytes_to_ints(in_array, 4)
Example #12
0
 def decode(in_array, param):
     return converters.convert_ints_to_chars(
         run_length_decode(converters.convert_bytes_to_ints(in_array, 4)))
Example #13
0
 def decode(in_array, param):
     return delta_decode(
         run_length_decode(converters.convert_bytes_to_ints(in_array, 4)))
Example #14
0
 def decode(in_array, param):
     return converters.convert_ints_to_floats(
         delta_decode(
             converters.recursive_index_decode(
                 converters.convert_bytes_to_ints(in_array, 2))), param)