def test_rom_interval(self): 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)
def setup_for(self, somecls, byte_size=2, address=443, **kwargs): 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, strings=False)) self.assertEqual(self.cls.size, byte_size)