Skip to content

Commit

Permalink
fix expression division and add test
Browse files Browse the repository at this point in the history
  • Loading branch information
W0ni committed Aug 19, 2024
1 parent 1ba37c3 commit 17e8f3e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
4 changes: 2 additions & 2 deletions miasm/expression/expression.py
Original file line number Diff line number Diff line change
Expand Up @@ -568,11 +568,11 @@ def __add__(self, other):
def __sub__(self, other):
return ExprOp('+', self, ExprOp('-', other))

def __div__(self, other):
def __truediv__(self, other):
return ExprOp('/', self, other)

def __floordiv__(self, other):
return self.__div__(other)
return self.__truediv__(other)

def __mod__(self, other):
return ExprOp('%', self, other)
Expand Down
8 changes: 8 additions & 0 deletions test/expression/expression.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,16 +80,24 @@

C = A+B
D = C + A
E = A / B
F = A // B

assert E is F

assert A in A
assert A in C
assert B in C
assert C in C
assert E in E
assert F in F

assert A in D
assert B in D
assert C in D
assert D in D
assert A in E
assert B in E

assert C not in A
assert C not in B
Expand Down

0 comments on commit 17e8f3e

Please sign in to comment.