示例#1
0
 def test_cmp(self):
     reg_src = instructions.RegSrc(registers.r4)
     reg_dst = instructions.RegDst(registers.r5)
     cp = instructions.Cmp(reg_src, reg_dst)
     self.assertSequenceEqual([cp, reg_src, reg_dst], list(cp.non_leaves))
示例#2
0
 def test_cmp(self):
     cp = instructions.Cmp(instructions.RegSrc(registers.r4),
                           instructions.RegDst(registers.r5))
     self.assertEqual([registers.r4, registers.r5], cp.used_registers)
     self.assertEqual([], cp.defined_registers)
示例#3
0
 def test_add_regs(self):
     mv = instructions.Addw(instructions.RegSrc(registers.r4),
                            instructions.RegDst(registers.r5))
     self.assertEqual([registers.r4, registers.r5], mv.used_registers)
     self.assertEqual([registers.r5], mv.defined_registers)
示例#4
0
 def test_add(self):
     add = instructions.Addw(instructions.RegSrc(registers.r2),
                             instructions.RegDst(registers.r3))
     self.assertEqual('add.w R2, R3', str(add))