about summary refs log tree commit diff stats
path: root/test
diff options
context:
space:
mode:
authorserpilliere <serpilliere@users.noreply.github.com>2018-02-15 23:28:36 +0100
committerGitHub <noreply@github.com>2018-02-15 23:28:36 +0100
commite933c0c31742ddb9dcfd9b46d93fe2a47553af5e (patch)
treea5b6ac1d9f3ecf6378d2ae33661b0433f5736dc6 /test
parent092d0bfaac18ffe683a8ef3a1dedc5dba80e7688 (diff)
parent2420df074cd2f3bb8b1e343a5bce6b83fffa9d80 (diff)
downloadmiasm-e933c0c31742ddb9dcfd9b46d93fe2a47553af5e.tar.gz
miasm-e933c0c31742ddb9dcfd9b46d93fe2a47553af5e.zip
Merge pull request #683 from commial/refactor/remove-default-exprmem-size
Refactor/remove default exprmem size
Diffstat (limited to 'test')
-rw-r--r--test/analysis/data_flow.py10
-rw-r--r--test/expression/simplifications.py20
-rwxr-xr-xtest/ir/symbexec.py14
3 files changed, 22 insertions, 22 deletions
diff --git a/test/analysis/data_flow.py b/test/analysis/data_flow.py
index dff88470..d0a85e13 100644
--- a/test/analysis/data_flow.py
+++ b/test/analysis/data_flow.py
@@ -553,7 +553,7 @@ G17_IRB0 = gen_irblock(LBL0, [[ExprAff(a, a*b),
                                ExprAff(b, a),
                                ExprAff(c, b)],
 
-                              [ExprAff(ExprMem(d+CST1), a),
+                              [ExprAff(ExprMem(d+CST1, 32), a),
                                ExprAff(a, b),
                                ExprAff(b, c),
                                ExprAff(c, CST1)],
@@ -562,7 +562,7 @@ G17_IRB0 = gen_irblock(LBL0, [[ExprAff(a, a*b),
                                ExprAff(b, a),
                                ExprAff(c, b)],
 
-                              [ExprAff(ExprMem(d+CST2), a),
+                              [ExprAff(ExprMem(d+CST2, 32), a),
                                ExprAff(a, b),
                                ExprAff(b, c),
                                ExprAff(c, CST1)],
@@ -593,7 +593,7 @@ G17_IRB0 = gen_irblock(LBL0, [[ExprAff(a, a*b),
                                ExprAff(b, a),
                                ExprAff(c, b)],
 
-                              [ExprAff(ExprMem(d), a+b+c)],
+                              [ExprAff(ExprMem(d, 32), a+b+c)],
 
                          ])
 
@@ -610,11 +610,11 @@ G17_EXP_IRB0 = gen_irblock(LBL0, [[],
 
                                   [ExprAff(a, CST1)],
 
-                                  [ExprAff(ExprMem(d+CST1), a)],
+                                  [ExprAff(ExprMem(d+CST1, 32), a)],
 
                                   [ExprAff(a, CST1)],
 
-                                  [ExprAff(ExprMem(d+CST2), a)],
+                                  [ExprAff(ExprMem(d+CST2, 32), a)],
 
                                   [ExprAff(a, CST2)],
 
diff --git a/test/expression/simplifications.py b/test/expression/simplifications.py
index 76deb565..3e2e5177 100644
--- a/test/expression/simplifications.py
+++ b/test/expression/simplifications.py
@@ -89,7 +89,7 @@ d8 = ExprId('d8', 8)
 e8 = ExprId('e8', 8)
 
 
-m = ExprMem(a)
+m = ExprMem(a, 32)
 s = a[:8]
 
 i0 = ExprInt(0, 32)
@@ -106,7 +106,7 @@ l = [a[:8], b[:8], c[:8], m[:8], s, i1[:8], i2[:8], o[:8]]
 l2 = l[::-1]
 
 
-x = ExprMem(a + b + ExprInt(0x42, 32))
+x = ExprMem(a + b + ExprInt(0x42, 32), 32)
 
 # Define tests: (expression to simplify, expected value)
 to_test = [(ExprInt(1, 32) - ExprInt(1, 32), ExprInt(0, 32)),
@@ -189,8 +189,8 @@ to_test = [(ExprInt(1, 32) - ExprInt(1, 32), ExprInt(0, 32)),
             ExprCompose(a[:16], a[:16]),),
            (ExprCompose(a[:16], a[16:32]), a),
 
-           (ExprMem(a)[:32], ExprMem(a)),
-           (ExprMem(a)[:16], ExprMem(a, size=16)),
+           (ExprMem(a, 32)[:32], ExprMem(a, 32)),
+           (ExprMem(a, 32)[:16], ExprMem(a, size=16)),
 
            (ExprCond(ExprInt(1, 32), a, b), a),
            (ExprCond(ExprInt(0, 32), b, a), a),
@@ -528,8 +528,8 @@ match_tests = [
     (match_expr(x + y, x + a, [a]), {a: y}),
     (match_expr(x + y, a + b, [a, b]), {a: x, b: y}),
     (match_expr(x + ExprInt(12, 32), a + b, [a, b]), {a: x, b: ExprInt(12, 32)}),
-    (match_expr(ExprMem(x), a, [a]), {a: ExprMem(x)}),
-    (match_expr(ExprMem(x), ExprMem(a), [a]), {a: x}),
+    (match_expr(ExprMem(x, 32), a, [a]), {a: ExprMem(x, 32)}),
+    (match_expr(ExprMem(x, 32), ExprMem(a, 32), [a]), {a: x}),
     (match_expr(x[0:8], a, [a]), {a: x[0:8]}),
     (match_expr(x[0:8], a[0:8], [a]), {a: x}),
     (match_expr(ExprCond(x, y, z), a, [a]), {a: ExprCond(x, y, z)}),
@@ -554,10 +554,10 @@ for test, res in match_tests:
 
 
 get_tests = [
-    (ExprAff(ExprMem(a), ExprMem(b)).get_r(True), set([a, b, ExprMem(b)])),
-    (ExprAff(ExprMem(a), ExprMem(b)).get_w(), set([ExprMem(a)])),
-    (ExprAff(ExprMem(ExprMem(a)), ExprMem(b))
-     .get_r(True), set([a, b, ExprMem(b), ExprMem(a)])),
+    (ExprAff(ExprMem(a, 32), ExprMem(b, 32)).get_r(True), set([a, b, ExprMem(b, 32)])),
+    (ExprAff(ExprMem(a, 32), ExprMem(b, 32)).get_w(), set([ExprMem(a, 32)])),
+    (ExprAff(ExprMem(ExprMem(a, 32), 32), ExprMem(b, 32))
+     .get_r(True), set([a, b, ExprMem(b, 32), ExprMem(a, 32)])),
 ]
 
 
diff --git a/test/ir/symbexec.py b/test/ir/symbexec.py
index 492dcfec..90d08d17 100755
--- a/test/ir/symbexec.py
+++ b/test/ir/symbexec.py
@@ -21,11 +21,11 @@ class TestSymbExec(unittest.TestCase):
         addr20 = ExprInt(20, 32)
         addr40 = ExprInt(40, 32)
         addr50 = ExprInt(50, 32)
-        mem0 = ExprMem(addr0)
+        mem0 = ExprMem(addr0, 32)
         mem1 = ExprMem(addr1, 8)
-        mem8 = ExprMem(addr8)
-        mem9 = ExprMem(addr9)
-        mem20 = ExprMem(addr20)
+        mem8 = ExprMem(addr8, 32)
+        mem9 = ExprMem(addr9, 32)
+        mem20 = ExprMem(addr20, 32)
         mem40v = ExprMem(addr40,  8)
         mem40w = ExprMem(addr40, 16)
         mem50v = ExprMem(addr50,  8)
@@ -41,9 +41,9 @@ class TestSymbExec(unittest.TestCase):
                                      id_a: addr0, id_eax: addr0})
         self.assertEqual(e.find_mem_by_addr(addr0), mem0)
         self.assertEqual(e.find_mem_by_addr(addrX), None)
-        self.assertEqual(e.eval_expr(ExprMem(addr1 - addr1)), id_x)
+        self.assertEqual(e.eval_expr(ExprMem(addr1 - addr1, 32)), id_x)
         self.assertEqual(e.eval_expr(ExprMem(addr1, 8)), id_y)
-        self.assertEqual(e.eval_expr(ExprMem(addr1 + addr1)), ExprCompose(
+        self.assertEqual(e.eval_expr(ExprMem(addr1 + addr1, 32)), ExprCompose(
             id_x[16:32], ExprMem(ExprInt(4, 32), 16)))
         self.assertEqual(e.eval_expr(mem8), ExprCompose(
             id_x[0:24], ExprMem(ExprInt(11, 32), 8)))
@@ -55,7 +55,7 @@ class TestSymbExec(unittest.TestCase):
         self.assertEqual(e.eval_expr(mem20), mem20)
         self.assertEqual(set(e.modified()), set(e.symbols))
         self.assertRaises(
-            KeyError, e.symbols.__getitem__, ExprMem(ExprInt(100, 32)))
+            KeyError, e.symbols.__getitem__, ExprMem(ExprInt(100, 32), 32))
         self.assertEqual(e.apply_expr(id_eax), addr0)
         self.assertEqual(e.apply_expr(ExprAff(id_eax, addr9)), addr9)
         self.assertEqual(e.apply_expr(id_eax), addr9)