about summary refs log tree commit diff stats
path: root/test/expression/simplifications.py
diff options
context:
space:
mode:
authorFabrice Desclaux <fabrice.desclaux@cea.fr>2015-03-24 10:31:47 +0100
committerFabrice Desclaux <fabrice.desclaux@cea.fr>2015-03-24 10:45:18 +0100
commit34765c384f2b445a6e0d61e4587fd0f2c196ee6f (patch)
tree611ff7950473346664a003015138fe9fde7dd9ed /test/expression/simplifications.py
parente1b36de304a5b9c86b204d095beee97f228cd95b (diff)
downloadmiasm-34765c384f2b445a6e0d61e4587fd0f2c196ee6f.tar.gz
miasm-34765c384f2b445a6e0d61e4587fd0f2c196ee6f.zip
Test/simplification: reg test reference must not be expr_simp to match result
Diffstat (limited to 'test/expression/simplifications.py')
-rw-r--r--test/expression/simplifications.py13
1 files changed, 6 insertions, 7 deletions
diff --git a/test/expression/simplifications.py b/test/expression/simplifications.py
index f4b4fcd6..15bc9d98 100644
--- a/test/expression/simplifications.py
+++ b/test/expression/simplifications.py
@@ -36,7 +36,7 @@ x = ExprMem(a + b + ExprInt32(0x42))
 # Define tests: (expression to simplify, expected value)
 to_test = [(ExprInt32(1) - ExprInt32(1), ExprInt32(0)),
            ((ExprInt32(5) + c + a + b - a + ExprInt32(1) - ExprInt32(5)),
-            b + c + ExprInt32(1)),
+            ExprOp('+', b, c, ExprInt32(1))),
            (a + b + c - a - b - c + a, a),
            (a + a + b + c - (a + (b + c)), a),
            (c ^ b ^ a ^ c ^ b, a),
@@ -52,13 +52,13 @@ to_test = [(ExprInt32(1) - ExprInt32(1), ExprInt32(0)),
            (ExprOp('<<<', a, ExprOp('<<<', b, c)),
             ExprOp('<<<', a, ExprOp('<<<', b, c))),
            (ExprOp('<<<', ExprOp('<<<', a, b), c),
-            ExprOp('<<<', ExprOp('<<<', a, b), c)),
+            ExprOp('<<<', a, (b+c))),
            (ExprOp('<<<', ExprOp('>>>', a, b), c),
-            ExprOp('<<<', ExprOp('>>>', a, b), c)),
+            ExprOp('>>>', a, (b-c))),
            (ExprOp('>>>', ExprOp('<<<', a, b), c),
-            ExprOp('>>>', ExprOp('<<<', a, b), c)),
+            ExprOp('<<<', a, (b-c))),
            (ExprOp('>>>', ExprOp('<<<', a, b), b),
-            ExprOp('>>>', ExprOp('<<<', a, b), b)),
+            a),
 
 
            (ExprOp('>>>', ExprOp('<<<', a, ExprInt32(10)), ExprInt32(2)),
@@ -137,7 +137,7 @@ to_test = [(ExprInt32(1) - ExprInt32(1), ExprInt32(0)),
     (ExprOp('*', -a, -b, c, ExprInt32(0x12)),
      ExprOp('*', a, b, c, ExprInt32(0x12))),
     (ExprOp('*', -a, -b, -c, ExprInt32(0x12)),
-     ExprOp('*', -a, b, c, ExprInt32(0x12))),
+     - ExprOp('*', a, b, c, ExprInt32(0x12))),
     (a | ExprInt32(0xffffffff),
      ExprInt32(0xffffffff)),
     (ExprCond(a, ExprInt32(1), ExprInt32(2)) * ExprInt32(4),
@@ -203,7 +203,6 @@ to_test = [(ExprInt32(1) - ExprInt32(1), ExprInt32(0)),
 for e, e_check in to_test[:]:
     #
     print "#" * 80
-    e_check = expr_simp(e_check)
     # print str(e), str(e_check)
     e_new = expr_simp(e)
     print "original: ", str(e), "new: ", str(e_new)