about summary refs log tree commit diff stats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/ir/symbexec.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/test/ir/symbexec.py b/test/ir/symbexec.py
index 6df0bbc3..24b02341 100644
--- a/test/ir/symbexec.py
+++ b/test/ir/symbexec.py
@@ -11,6 +11,7 @@ class TestSymbExec(unittest.TestCase):
             ExprCompose, ExprAff
         from miasm2.arch.x86.sem import ir_x86_32
         from miasm2.ir.symbexec import symbexec
+        from miasm2.ir.ir import AssignBlock
 
         addrX = ExprInt32(-1)
         addr0 = ExprInt32(0)
@@ -59,6 +60,22 @@ class TestSymbExec(unittest.TestCase):
         self.assertEqual(e.apply_expr(ExprAff(id_eax, addr9)), addr9)
         self.assertEqual(e.apply_expr(id_eax), addr9)
 
+        # apply_change / eval_ir / apply_expr
+
+        ## x = a (with a = 0x0)
+        assignblk = AssignBlock()
+        assignblk[id_x] = id_a
+        e.eval_ir(assignblk)
+        self.assertEqual(e.apply_expr(id_x), addr0)
+
+        ## x = a (without replacing 'a' with 0x0)
+        e.apply_change(id_x, id_a)
+        self.assertEqual(e.apply_expr(id_x), id_a)
+
+        ## x = a (with a = 0x0)
+        self.assertEqual(e.apply_expr(assignblk.dst2ExprAff(id_x)), addr0)
+        self.assertEqual(e.apply_expr(id_x), addr0)
+
 if __name__ == '__main__':
     testsuite = unittest.TestLoader().loadTestsFromTestCase(TestSymbExec)
     report = unittest.TextTestRunner(verbosity=2).run(testsuite)