diff options
| author | serpilliere <devnull@localhost> | 2014-06-13 09:36:58 +0200 |
|---|---|---|
| committer | serpilliere <devnull@localhost> | 2014-06-13 09:36:58 +0200 |
| commit | b2f02006df9487905384cd7654e003dbf01419a0 (patch) | |
| tree | da1ded03ba7204368d6195a5fa1dd95e61a996e1 /test/expression/simplifications.py | |
| parent | 24b677448d875d408c1fff038bed27d2b223a3da (diff) | |
| download | miasm-b2f02006df9487905384cd7654e003dbf01419a0.tar.gz miasm-b2f02006df9487905384cd7654e003dbf01419a0.zip | |
Simplification: detect and handle == condition
Add corresponding regression tests
Diffstat (limited to 'test/expression/simplifications.py')
| -rw-r--r-- | test/expression/simplifications.py | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/test/expression/simplifications.py b/test/expression/simplifications.py index ac6b796d..6b437218 100644 --- a/test/expression/simplifications.py +++ b/test/expression/simplifications.py @@ -4,7 +4,7 @@ from pdb import pm from miasm2.expression.expression import * from miasm2.expression.simplifications import expr_simp, ExpressionSimplifier -from miasm2.expression.simplifications_cond import ExprOp_inf_signed, ExprOp_inf_unsigned +from miasm2.expression.simplifications_cond import ExprOp_inf_signed, ExprOp_inf_unsigned, ExprOp_equal # Define example objects a = ExprId('a') @@ -75,11 +75,6 @@ to_test = [(ExprInt32(1) - ExprInt32(1), ExprInt32(0)), ExprInt32(0xFF123456)), (ExprOp("a>>", (ExprInt32(0xF1234567)), ExprInt32(28)), ExprInt32(0xFFFFFFFF)), - (ExprOp("==", ExprInt32(12), ExprInt32(10)), ExprInt32(0)), - (ExprOp("==", ExprInt32(12), ExprInt32(12)), ExprInt32(1)), - (ExprOp("==", a | ExprInt32(12), ExprInt32(0)), ExprInt32(0)), - (ExprOp("==", a | ExprInt32(12), ExprInt32(14)), - ExprOp("==", a | ExprInt32(12), ExprInt32(14))), (ExprOp("parity", ExprInt32(0xf)), ExprInt1(1)), (ExprOp("parity", ExprInt32(0xe)), ExprInt1(0)), (ExprInt32(0x4142)[:32], ExprInt32(0x4142)), @@ -185,6 +180,11 @@ to_test = [ (ExprOp_inf_signed(ExprInt32(-1), ExprInt32(3)), ExprInt1(1)), (ExprOp_inf_unsigned(a, b) ^ (a ^ b).msb(), ExprOp_inf_signed(a, b)), (ExprOp_inf_signed(a, b) ^ (a ^ b).msb(), ExprOp_inf_unsigned(a, b)), + (ExprOp_equal(ExprInt32(12), ExprInt32(10)), ExprInt1(0)), + (ExprOp_equal(ExprInt32(12), ExprInt32(12)), ExprInt1(1)), + (ExprOp_equal(ExprInt32(12), ExprInt32(-12)), ExprInt1(0)), + (ExprCond(a - b, ExprInt1(0), ExprInt1(1)), ExprOp_equal(a, b)), + (ExprCond(a + b, ExprInt1(0), ExprInt1(1)), ExprOp_equal(a, -b)), ] expr_simp_cond = ExpressionSimplifier() |