Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Add execute state test
  • Loading branch information
JoranHonig committed May 7, 2018
1 parent 08fa43a commit 0b9bff1
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
2 changes: 2 additions & 0 deletions requirements.txt
Expand Up @@ -2,3 +2,5 @@ z3-solver>=4.5
py-flags
coverage
pytest
mock
pytest_mock
26 changes: 26 additions & 0 deletions tests/taint_runner_test.py
@@ -0,0 +1,26 @@
import mock
import pytest
from pytest_mock import mocker
from laser.ethereum.taint_analysis import *
from laser.ethereum.svm import GlobalState


def test_execute_state(mocker):
record = TaintRecord()
record.stack_record = {
0: True,
1: False,
2: True
}

state = GlobalState
mocker.patch.object(state, 'get_current_instruction')
state.get_current_instruction.return_value = {"opcode": "ADD"}

# Act
TaintRunner.execute_state(record, state)

# Assert
assert list(record.stack_record.items()) == [(0, True), (1, True)]


0 comments on commit 0b9bff1

Please sign in to comment.