Skip to content

Commit 206f13d

Browse files
committed
Add test for xor a asm instruction
Test for both dependency and evaluated values.
1 parent 26c9b98 commit 206f13d

2 files changed

Lines changed: 17 additions & 0 deletions

File tree

tests/arch/zx48k/backend/test_memcell.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,3 +122,10 @@ def test_require_destroys_asm(self):
122122
'r', 'i', 'sp'})
123123

124124
del arch.zx48k.backend.ASMS['##ASM0']
125+
126+
def test_requires_xor_a(self):
127+
""" Test requires for xor a instruction
128+
"""
129+
c = memcell.MemCell('xor a', 1)
130+
self.assertSetEqual(c.requires, set())
131+
self.assertSetEqual(c.destroys, {'a', 'f'})

tests/arch/zx48k/optimizer/test_cpustate.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -296,3 +296,13 @@ def test_reset_mem(self):
296296
self.cpu_state.mem['_test'] = '5'
297297
self.cpu_state.reset()
298298
self.assertNotEqual(self.cpu_state.mem['_test'], '5')
299+
300+
def test_xor_a(self):
301+
code = """
302+
xor a
303+
"""
304+
self._eval(code)
305+
self.assertEqual(self.regs['a'], '0')
306+
self.assertEqual(self.cpu_state.C, 0)
307+
self.assertEqual(self.cpu_state.Z, 1)
308+
# Must not crash

0 commit comments

Comments
 (0)