diff options
Diffstat (limited to 'test')
| -rw-r--r-- | test/arch/mep/ir/test_divide.py | 24 | ||||
| -rw-r--r-- | test/expression/simplifications.py | 9 | ||||
| -rwxr-xr-x | test/ir/ir2C.py | 4 |
3 files changed, 12 insertions, 25 deletions
diff --git a/test/arch/mep/ir/test_divide.py b/test/arch/mep/ir/test_divide.py index 04d5f6c5..a63d0c5e 100644 --- a/test/arch/mep/ir/test_divide.py +++ b/test/arch/mep/ir/test_divide.py @@ -39,33 +39,21 @@ class TestDivide: exec_instruction("DIV R0, R1", [(ExprId("R0", 32), ExprInt(4, 32)), (ExprId("R1", 32), ExprInt(2, 32))], - [(ExprId("HI", 32), ExprCond(ExprOp("==", - ExprInt(0, 32), - ExprInt(0x80000000, 32)), - ExprInt(0, 32), - ExprInt(0xFFFFFFFC, 32))), - (ExprId("LO", 32), ExprCond(ExprOp("==", - ExprInt(0, 32), - ExprInt(0x80000000, 32)), - ExprInt(2, 32), - ExprInt(0, 32)))]) + [(ExprId("HI", 32), ExprInt(0xFFFFFFFC, 32)), + (ExprId("LO", 32), ExprInt(0, 32))]) # Negative & positive numbers exec_instruction("DIV R0, R1", [(ExprId("R0", 32), ExprInt(-5, 32)), (ExprId("R1", 32), ExprInt(2, 32))], - [(ExprId("HI", 32), ExprCond(ExprOp("==", ExprInt(0, 32), ExprInt(0x80000000, 32)), - ExprInt(1, 32), ExprInt(0xFFFFFFFF, 32))), - (ExprId("LO", 32), ExprCond(ExprOp("==", ExprInt(0, 32), ExprInt(0x80000000, 32)), - ExprInt(0x7FFFFFFD, 32), ExprInt(0xFFFFFFFE, 32)))]) + [(ExprId("HI", 32), ExprInt(0xFFFFFFFF, 32)), + (ExprId("LO", 32), ExprInt(0xFFFFFFFE, 32))]) exec_instruction("DIV R0, R1", [(ExprId("R0", 32), ExprInt(5, 32)), (ExprId("R1", 32), ExprInt(-2, 32))], - [(ExprId("HI", 32), ExprCond(ExprOp("==", ExprInt(0, 32), ExprInt(0x80000000, 32)), - ExprInt(5, 32), ExprInt(0xFFFFFFFF, 32))), - (ExprId("LO", 32), ExprCond(ExprOp("==", ExprInt(0, 32), ExprInt(0x80000000, 32)), - ExprInt(0, 32), ExprInt(0xFFFFFFFE, 32)))]) + [(ExprId("HI", 32), ExprInt(0xFFFFFFFF, 32)), + (ExprId("LO", 32), ExprInt(0xFFFFFFFE, 32))]) def test_divu(self): """Test DIVU execution""" diff --git a/test/expression/simplifications.py b/test/expression/simplifications.py index 1d91f109..046c948e 100644 --- a/test/expression/simplifications.py +++ b/test/expression/simplifications.py @@ -479,19 +479,18 @@ to_test = [ (ExprOp_inf_signed(ExprInt(-3, 32), ExprInt(0, 32)), ExprInt(1, 1)), ] -expr_simp_cond = ExpressionSimplifier() -expr_simp_explicit.enable_passes(ExpressionSimplifier.PASS_COND) +expr_simp.enable_passes(ExpressionSimplifier.PASS_COND) for e_input, e_check in to_test: print "#" * 80 - e_check = expr_simp_explicit(e_check) - e_new = expr_simp_explicit(e_input) + e_check = expr_simp(e_check) + e_new = expr_simp(e_input) print "original: ", str(e_input), "new: ", str(e_new) rez = e_new == e_check if not rez: raise ValueError( - 'bug in expr_simp_explicit simp(%s) is %s and should be %s' % (e_input, e_new, e_check)) + 'bug in expr_simp simp(%s) is %s and should be %s' % (e_input, e_new, e_check)) if args.z3: # This check is done on 32 bits, but the size is not use by Miasm formulas, so diff --git a/test/ir/ir2C.py b/test/ir/ir2C.py index 375dedb8..6df439c2 100755 --- a/test/ir/ir2C.py +++ b/test/ir/ir2C.py @@ -2,7 +2,7 @@ #-*- coding:utf-8 -*- import unittest - +from miasm2.expression.expression import TOK_EQUAL class TestIrIr2C(unittest.TestCase): @@ -32,7 +32,7 @@ class TestIrIr2C(unittest.TestCase): # Binary operators self.translationTest( - ExprOp('==', *args[:2]), r'(((0x0&0xffffffff) == (0x1&0xffffffff))?1:0)') + ExprOp(TOK_EQUAL, *args[:2]), r'(((0x0&0xffffffff) == (0x1&0xffffffff))?1:0)') self.translationTest( ExprOp('%', *args[:2]), r'(((0x0&0xffffffff)%(0x1&0xffffffff))&0xffffffff)') self.translationTest( |