

def test_loop(self):
    asm_instrs_str = [(134512736, 'mov eax,0x0', 5)]
    asm_instrs_str += [(134512741, 'mov ebx,0xa', 5)]
    asm_instrs_str += [(134512746, 'add eax,0x1', 3)]
    asm_instrs_str += [(134512749, 'sub ebx,0x1', 3)]
    asm_instrs_str += [(134512752, 'cmp ebx,0x0', 3)]
    asm_instrs_str += [(134512755, 'jne 0x0804806a', 2)]
    asm_instrs = []
    for (addr, asm, size) in asm_instrs_str:
        asm_instr = self._asm_parser.parse(asm)
        asm_instr.address = addr
        asm_instr.size = size
        asm_instrs.append(asm_instr)
    reil_instrs = self.__translate(asm_instrs)
    (regs_final, _) = self._emulator.execute(reil_instrs, start=(134512736 << 8))
    self.assertEqual(regs_final['eax'], 10)
    self.assertEqual(regs_final['ebx'], 0)

dataset/ETHPy150Open programa-stic/barf-project/barf/tests/core/reil/test_reilemulator.py ReilEmulatorTests.test_loop/original