def test9_function3(self): numbers = { 777: '0309', -777: '03 09', 1020: '03 FC ', -1020: ' -03 FC' } for num in numbers: self.assertNotEqual(conv_endian(num, 'big'), numbers.get(num))
def test1_function3(self): for i in range(0, 10000): decimal = random.randint(-999999, 999999) negative = bool(decimal < 0) num = abs(decimal) big_hex = hex(num)[2:].upper() if len(big_hex) % 2 == 1: big_hex = '0' + big_hex big_hex = ' '.join(big_hex[i:i + 2] for i in range(0, len(big_hex), 2)) if negative: big_hex = '-' + big_hex self.assertEqual(conv_endian(decimal, 'big'), big_hex)
def test2_function3(self): for i in range(0, 10000): decimal = random.randint(-999999, 999999) negative = bool(decimal < 0) num = abs(decimal) little_hex = hex(num)[2:].upper() if len(little_hex) % 2 == 1: little_hex = '0' + little_hex little_hex = ' '.join( little_hex[i:i + 2] for i in range(len(little_hex), -1, -2)).strip() if negative: little_hex = '-' + little_hex self.assertEqual(conv_endian(decimal, 'little'), little_hex)
def test4_function3(self): numbers = {-1: "-01", 0: "00", 1: "01"} for num in numbers: self.assertEqual(conv_endian(num, endian='little'), numbers.get(num))
def test5_function3(self): numbers = {954786: '0E 91 A2', -954786: '-0E 91 A2'} for num in numbers: self.assertEqual(conv_endian(num), numbers.get(num))
def test3_func3(self): """Test for little endian. Expected: A2 91 0E (class example)""" self.assertEqual(conv_endian(954786, 'little'), 'A2 91 0E')
def test17(self): num = 954786 self.assertEqual(conv_endian(num, 'big'), '0E 91 A2')
def test10_function3(self): self.assertEqual(conv_endian(num=-954786, endian='Little'), None)
def test1_func3(self): """Expected result is 0E 91 A2 (class example)""" # fix this when the function is working self.assertEqual(conv_endian(954786, 'big'), '0E 91 A2')
def test24(self): num = 4325 self.assertEqual(conv_endian(num), '10 E5')
def test8_function3(self): self.assertEqual(conv_endian(num=-954786, endian='little'), '-A2 91 0E')
def test22(self): num = -954786 self.assertEqual(conv_endian(num, endian='little'), '-A2 91 0E')
def test23(self): num = -954786 self.assertEqual(conv_endian(num, endian='small'), None)
def test20(self): num = 954786 self.assertEqual(conv_endian(num, 'little'), 'A2 91 0E')
def test19(self): num = -954786 self.assertEqual(conv_endian(num), '-0E 91 A2')
def test18(self): num = 954786 self.assertEqual(conv_endian(num), '0E 91 A2')
def test6_function3(self): numbers = {954786: 'A2 91 0E', -954786: '-A2 91 0E'} for num in numbers: self.assertEqual(conv_endian(num, 'little'), numbers.get(num))
def test25(self): num = 4325 self.assertEqual(conv_endian(num, 'little'), 'E5 10')
def test7_function3(self): self.assertEqual(conv_endian(954786, 'big'), '0E 91 A2')
def test26(self): num = 4325 self.assertEqual(conv_endian(num, 'liTTle'), None)
def test_conv_endian28(self): num = -1234567 expected = None self.assertEqual(conv_endian(num, 'false'), expected)
def test27(self): num = 4325 self.assertEqual(conv_endian(num, 'BiG'), None)
def test11_function3(self): numbers = {-1: "-01", 0: "00", 1: "01"} for num in numbers: self.assertEqual(conv_endian(num, 'Big'), None)
def test5_func3(self): """Test that explicit parameter invocations are accepted (class example)""" self.assertEqual(conv_endian(num=-954786, endian='little'), '-A2 91 0E')
def test2_func3(self): """Test for negative number handling. Expected -0E 91 A2 (class example)""" self.assertEqual(conv_endian(-954786), '-0E 91 A2')
def test_conv_endian27(self): num = -1234567 expected = '-12 D6 87' self.assertEqual(conv_endian(num), expected)
def test4_func3(self): """Test for negative little endian. Expected: -A2 91 0E (class example)""" self.assertEqual(conv_endian(-954786, 'little'), '-A2 91 0E')
def test_conv_endian29(self): num = 0 expected = None self.assertEqual(conv_endian(num, 'goodbye'), expected)
def test6_func3(self): """Test that invalid second parameter returns None (class example)""" self.assertEqual(conv_endian(num=-955786, endian='small'), None)
def test_conv_endian25(self): num = -1234567 expected = '-87 D6 12' self.assertEqual(conv_endian(num, 'little'), expected)