From f8ed65ef0a811031fce22353e0a6a05b4860952f Mon Sep 17 00:00:00 2001 From: Joran Honig Date: Sat, 2 Jun 2018 14:15:00 +0200 Subject: [PATCH] Cleanup concrete call test and add not concrete call test --- tests/analysis/delegatecall_test.py | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/tests/analysis/delegatecall_test.py b/tests/analysis/delegatecall_test.py index 8a4d4ad5..3b4697a9 100644 --- a/tests/analysis/delegatecall_test.py +++ b/tests/analysis/delegatecall_test.py @@ -7,21 +7,22 @@ import mock from mock import patch import pytest_mock + def test_concrete_call(): # arrange address = "0x10" - state = GlobalState(None, None) - node = Node("example") - to = Variable(1, VarType.CONCRETE) - meminstart = Variable(1, VarType.CONCRETE) - - call = Call(node, state, None, None, to, None) + state = GlobalState(None, None) state.mstate.memory = ["placeholder", "calldata_bling_0"] + node = Node("example") node.contract_name = "the contract name" node.function_name = "the function name" + to = Variable(1, VarType.CONCRETE) + meminstart = Variable(1, VarType.CONCRETE) + call = Call(node, state, None, None, to, None) + # act issues = _concrete_call(call, state, address, meminstart) @@ -38,6 +39,19 @@ def test_concrete_call(): "calling contract.\n DELEGATECALL target: 0x1" +def test_concrete_call_not_calldata(): + # arrange + state = GlobalState(None, None) + state.mstate.memory = ["placeholder", "not_calldata"] + meminstart = Variable(1, VarType.CONCRETE) + + # act + issues = _concrete_call(None, state, None, meminstart) + + # assert + assert issues == [] + + def test_symbolic_call(mocker): # arrange address = "0x10"