about summary refs log tree commit diff stats
path: root/test/arch/mep/ir/test_ir.py
diff options
context:
space:
mode:
Diffstat (limited to 'test/arch/mep/ir/test_ir.py')
-rw-r--r--test/arch/mep/ir/test_ir.py35
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)