diff options
| author | Fabrice Desclaux <fabrice.desclaux@cea.fr> | 2019-02-25 11:09:54 +0100 |
|---|---|---|
| committer | Fabrice Desclaux <fabrice.desclaux@cea.fr> | 2019-03-05 16:52:49 +0100 |
| commit | 02bbb30efea4980c9d133947cbbf69fb599071ad (patch) | |
| tree | 3fea6826fcc5354840a27cb1dc99ff31eef81896 /test/arch/mep/ir/test_ir.py | |
| parent | eab809932871f91d6f4aa770fc321af9e156e0f5 (diff) | |
| download | miasm-02bbb30efea4980c9d133947cbbf69fb599071ad.tar.gz miasm-02bbb30efea4980c9d133947cbbf69fb599071ad.zip | |
Support python2/python3
Diffstat (limited to 'test/arch/mep/ir/test_ir.py')
| -rw-r--r-- | test/arch/mep/ir/test_ir.py | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/test/arch/mep/ir/test_ir.py b/test/arch/mep/ir/test_ir.py index 3fec9ec9..be717db8 100644 --- a/test/arch/mep/ir/test_ir.py +++ b/test/arch/mep/ir/test_ir.py @@ -1,6 +1,9 @@ # Toshiba MeP-c4 - Misc unit tests # Guillaume Valadon <guillaume@valadon.net> +from __future__ import print_function + +from miasm2.core.utils import decode_hex 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 @@ -9,7 +12,7 @@ from miasm2.ir.symbexec import SymbolicExecutionEngine from miasm2.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) |