Exemplo n.º 1
0
 def test_not_equal2(self):
     hf1 = HexFile()
     hf2 = HexFile()
     hf1.add_region(10, bytes.fromhex('aabbcc'))
     hf2.add_region(10, bytes.fromhex('aabbcc'))
     hf2.add_region(22, bytes.fromhex('aabbcc'))
     self.assertNotEqual(hf1, hf2)
Exemplo n.º 2
0
 def test_two_regions(self):
     hf = HexFile()
     hf2 = HexFile()
     hf.add_region(0x100, bytes.fromhex('abcd'))
     hf.add_region(0x200, bytes.fromhex('beef'))
     hf2.add_region(0x200, bytes.fromhex('beef'))
     hf2.add_region(0x100, bytes.fromhex('abcd'))
     self.assertEqual(hf, hf2)
Exemplo n.º 3
0
 def test_overlapped(self):
     hf = HexFile()
     hf.add_region(0x10, bytes.fromhex('abcdab'))
     with self.assertRaisesRegex(HexFileException, 'verlap'):
         hf.add_region(0x12, bytes.fromhex('abcdab'))
Exemplo n.º 4
0
 def test_merge(self):
     hf = HexFile()
     hf.add_region(0x10, bytes.fromhex('abcdab'))
     hf.add_region(0x13, bytes.fromhex('abcdab'))
     self.assertEqual(1, len(hf.regions))
Exemplo n.º 5
0
 def test_save5(self):
     hf = HexFile()
     hf.add_region(0xF003, bytes.fromhex('ab') * 0x10000)
     self.save_load(hf)
Exemplo n.º 6
0
 def test_save3(self):
     hf = HexFile()
     hf.add_region(0x8000, bytes.fromhex('aabbcc'))
     hf.add_region(0xFFFE, bytes.fromhex('aabbcc'))
     self.save_load(hf)