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))
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))
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))
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))
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))
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))
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)
def decode(in_array,param): return converters.convert_bytes_to_ints(in_array, 4)
def decode(in_array, param): return converters.convert_ints_to_chars( run_length_decode( converters.convert_bytes_to_ints(in_array, 4)))
def decode(in_array, param): return delta_decode( run_length_decode( converters.convert_bytes_to_ints(in_array, 4)))
def decode(in_array, param): return converters.convert_bytes_to_ints(in_array, 4)
def decode(in_array, param): return converters.convert_ints_to_chars( run_length_decode(converters.convert_bytes_to_ints(in_array, 4)))
def decode(in_array, param): return delta_decode( run_length_decode(converters.convert_bytes_to_ints(in_array, 4)))
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)