diff options
| author | Camille Mougey <commial@gmail.com> | 2019-03-07 14:37:07 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-03-07 14:37:07 +0100 |
| commit | 4c2320b46250a8d6f8774e1218544b72a154cd8e (patch) | |
| tree | b67e7b072439f84109bd39dad8ed7f3f135224f8 /test/arch/mep/ir/test_ir.py | |
| parent | eab809932871f91d6f4aa770fc321af9e156e0f5 (diff) | |
| parent | 26c1075723a02984da6d3bc7423c5c0c43082dc3 (diff) | |
| download | miasm-4c2320b46250a8d6f8774e1218544b72a154cd8e.tar.gz miasm-4c2320b46250a8d6f8774e1218544b72a154cd8e.zip | |
Merge pull request #990 from serpilliere/support_python2_python3
Support python2 python3
Diffstat (limited to 'test/arch/mep/ir/test_ir.py')
| -rw-r--r-- | test/arch/mep/ir/test_ir.py | 35 |
1 files changed, 19 insertions, 16 deletions
diff --git a/test/arch/mep/ir/test_ir.py b/test/arch/mep/ir/test_ir.py index 3fec9ec9..be8e24e1 100644 --- a/test/arch/mep/ir/test_ir.py +++ b/test/arch/mep/ir/test_ir.py @@ -1,15 +1,18 @@ # Toshiba MeP-c4 - Misc unit tests # Guillaume Valadon <guillaume@valadon.net> -from miasm2.arch.mep.arch import mn_mep -from miasm2.arch.mep.regs import regs_init -from miasm2.arch.mep.ira import ir_mepb, ir_a_mepb -from miasm2.expression.expression import ExprId, ExprInt, ExprMem -from miasm2.ir.symbexec import SymbolicExecutionEngine -from miasm2.core.locationdb import LocationDB +from __future__ import print_function +from miasm.core.utils import decode_hex +from miasm.arch.mep.arch import mn_mep +from miasm.arch.mep.regs import regs_init +from miasm.arch.mep.ira import ir_mepb, ir_a_mepb +from miasm.expression.expression import ExprId, ExprInt, ExprMem +from miasm.ir.symbexec import SymbolicExecutionEngine +from miasm.core.locationdb import LocationDB -class TestMisc: + +class TestMisc(object): def test(self): @@ -18,16 +21,16 @@ class TestMisc: def exec_instruction(hex_asm, init_values): """Symbolically execute an instruction""" - print "Hex:", hex_asm + print("Hex:", hex_asm) # Disassemble an instruction - mn = mn_mep.dis(hex_asm.decode("hex"), "b") - print "Dis:", mn + mn = mn_mep.dis(decode_hex(hex_asm), "b") + print("Dis:", mn) # Get the IR im = ir_mepb() iir, eiir, = im.get_ir(mn) - print "\nInternal representation:", iir + print("\nInternal representation:", iir) # Symbolic execution loc_db = LocationDB() @@ -37,13 +40,13 @@ class TestMisc: for reg_expr_id, reg_expr_value in init_values: sb.symbols[reg_expr_id] = reg_expr_value - print "\nModified registers:", [reg for reg in sb.modified(mems=False)] - print "Modified memories:", [mem for mem in sb.modified()] + print("\nModified registers:", [reg for reg in sb.modified(mems=False)]) + print("Modified memories:", [mem for mem in sb.modified()]) - print "\nFinal registers:" + print("\nFinal registers:") sb.dump(mems=False) - print "\nFinal mems:" + print("\nFinal mems:") sb.dump() for hex_asm, init_values in [("6108", [(ExprId("R1", 32), ExprInt(0x40, 32))]), @@ -52,5 +55,5 @@ class TestMisc: ("0948", [(ExprId("R4", 32), ExprInt(0x41, 32)), (ExprId("R9", 32), ExprInt(0x28, 32)), (ExprMem(ExprInt(0x41, 32), 8), ExprInt(0, 8))])]: - print "-" * 49 # Tests separation + print("-" * 49) # Tests separation exec_instruction(hex_asm, init_values) |