Security analysis tool for EVM bytecode. Supports smart contracts built for Ethereum, Hedera, Quorum, Vechain, Roostock, Tron and other EVM-compatible blockchains.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
mythril/tests/laser/smt/independece_solver_test.py

33 lines
643 B

from mythril.laser.smt.independence_solver import _get_expr_variables
import z3
def test_get_expr_variables():
# Arrange
x = z3.Bool('x')
y = z3.Int('y')
z = z3.Int('z')
b = z3.Int('b')
expression = z3.If(x, y, z + b)
# Act
variables = _get_expr_variables(expression)
# Assert
assert x in variables
assert y in variables
assert z in variables
assert b in variables
def test_get_expr_variables_num():
# Arrange
b = z3.BitVec('b', 256)
expression = b + z3.BitVecVal(2, 256)
# Act
variables = _get_expr_variables(expression)
# Assert
assert [b] == variables