Exemplo n.º 1
0
 def test_load_rom(self):
     global rom
     rom = None
     load_rom()
     self.failIf(rom == None)
     rom = RomStr(None)
     load_rom()
     self.failIf(rom == RomStr(None))
 def test_load_rom(self):
     global rom
     rom = None
     load_rom()
     self.failIf(rom == None)
     rom = RomStr(None)
     load_rom()
     self.failIf(rom == RomStr(None))
 def test_rom_until(self):
     global rom
     load_rom()
     address = 0x1337
     byte = 0x13
     bytes = rom.until(address, byte, strings=True)
     self.failUnless(len(bytes) == 3)
     self.failUnless(bytes[0] == '0xd5')
     bytes = rom.until(address, byte, strings=False)
     self.failUnless(len(bytes) == 3)
     self.failUnless(bytes[0] == 0xd5)
Exemplo n.º 4
0
 def test_rom_until(self):
     global rom
     load_rom()
     address = 0x1337
     byte = 0x13
     bytes = rom.until(address, byte, strings=True)
     self.failUnless(len(bytes) == 3)
     self.failUnless(bytes[0] == '0xd5')
     bytes = rom.until(address, byte, strings=False)
     self.failUnless(len(bytes) == 3)
     self.failUnless(bytes[0] == 0xd5)
 def test_rom_interval(self):
     global rom
     load_rom()
     address = 0x100
     interval = 10
     correct_strings = ['0x0', '0xc3', '0x6e', '0x1', '0xce',
                        '0xed', '0x66', '0x66', '0xcc', '0xd']
     byte_strings = rom.interval(address, interval, strings=True)
     self.assertEqual(byte_strings, correct_strings)
     correct_ints = [0, 195, 110, 1, 206, 237, 102, 102, 204, 13]
     ints = rom.interval(address, interval, strings=False)
     self.assertEqual(ints, correct_ints)
Exemplo n.º 6
0
 def test_rom_interval(self):
     global rom
     load_rom()
     address = 0x100
     interval = 10
     correct_strings = [
         '0x0', '0xc3', '0x6e', '0x1', '0xce', '0xed', '0x66', '0x66',
         '0xcc', '0xd'
     ]
     byte_strings = rom.interval(address, interval, strings=True)
     self.assertEqual(byte_strings, correct_strings)
     correct_ints = [0, 195, 110, 1, 206, 237, 102, 102, 204, 13]
     ints = rom.interval(address, interval, strings=False)
     self.assertEqual(ints, correct_ints)
Exemplo n.º 7
0
 def setup_for(self, somecls, byte_size=2, address=443, **kwargs):
     self.rom = load_rom()
     self.cls = somecls(address=address, size=byte_size, **kwargs)
     self.assertEqual(self.cls.address, address)
     self.assertEqual(
         self.cls.bytes,
         rom_interval(address, byte_size, rom=self.rom, strings=False))
     self.assertEqual(self.cls.size, byte_size)
 def test_load_map_group_offsets(self):
     rom = load_rom()
     map_group_pointer_table = 0x94000
     map_group_count = 26
     addresses = load_map_group_offsets(map_group_pointer_table, map_group_count, rom=rom)
     self.assertEqual(len(addresses), 26, msg="there should be 26 map groups")
     addresses = load_map_group_offsets(map_group_pointer_table, map_group_count, rom=rom)
     self.assertEqual(len(addresses), 26, msg="there should still be 26 map groups")
     self.assertIn(0x94034, addresses)
     for address in addresses:
         self.assertGreaterEqual(address, 0x4000)
         self.failIf(0x4000 <= address <= 0x7FFF)
         self.failIf(address <= 0x4000)
Exemplo n.º 9
0
 def test_load_map_group_offsets(self):
     rom = load_rom()
     map_group_pointer_table = 0x94000
     map_group_count = 26
     addresses = load_map_group_offsets(map_group_pointer_table,
                                        map_group_count,
                                        rom=rom)
     self.assertEqual(len(addresses),
                      26,
                      msg="there should be 26 map groups")
     addresses = load_map_group_offsets(map_group_pointer_table,
                                        map_group_count,
                                        rom=rom)
     self.assertEqual(len(addresses),
                      26,
                      msg="there should still be 26 map groups")
     self.assertIn(0x94034, addresses)
     for address in addresses:
         self.assertGreaterEqual(address, 0x4000)
         self.failIf(0x4000 <= address <= 0x7FFF)
         self.failIf(address <= 0x4000)
 def setUpClass(cls):
     load_rom()
     cls.address = 10
     cls.sbp = SingleByteParam(address=cls.address)
Exemplo n.º 11
0
 def setup_for(self, somecls, byte_size=2, address=443, **kwargs):
     self.rom = load_rom()
     self.cls = somecls(address=address, size=byte_size, **kwargs)
     self.assertEqual(self.cls.address, address)
     self.assertEqual(self.cls.bytes, rom_interval(address, byte_size, rom=self.rom, strings=False))
     self.assertEqual(self.cls.size, byte_size)
Exemplo n.º 12
0
 def test_load_rom(self):
     rom = load_rom()
     self.assertNotEqual(rom, None)
     rom = load_rom()
     self.assertNotEqual(rom, RomStr(None))
Exemplo n.º 13
0
 def setUpClass(cls):
     load_rom()
     cls.address = 10
     cls.sbp = SingleByteParam(address=cls.address)
Exemplo n.º 14
0
 def test_load_rom(self):
     rom = load_rom()
     self.assertNotEqual(rom, None)
     rom = load_rom()
     self.assertNotEqual(rom, RomStr(None))