mirror of https://github.com/ConsenSys/mythril
blockchainethereumsmart-contractssoliditysecurityprogram-analysissecurity-analysissymbolic-execution
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.
30 lines
644 B
30 lines
644 B
7 years ago
|
from mythril.laser.ethereum.taint_analysis import *
|
||
|
|
||
|
def test_mutate_not_tainted():
|
||
|
# Arrange
|
||
|
record = TaintRecord()
|
||
|
|
||
|
record.stack = [True, False, False]
|
||
|
# Act
|
||
|
TaintRunner.mutate_stack(record, (2,1))
|
||
|
|
||
|
# Assert
|
||
|
assert record.stack_tainted(0)
|
||
|
assert record.stack_tainted(1) is False
|
||
|
assert record.stack == [True, False]
|
||
|
|
||
|
|
||
|
def test_mutate_tainted():
|
||
|
# Arrange
|
||
|
record = TaintRecord()
|
||
|
|
||
|
record.stack = [True, False, True]
|
||
|
|
||
|
# Act
|
||
|
TaintRunner.mutate_stack(record, (2, 1))
|
||
|
|
||
|
# Assert
|
||
|
assert record.stack_tainted(0)
|
||
|
assert record.stack_tainted(1)
|
||
|
assert record.stack == [True, True]
|