mirror of https://github.com/ConsenSys/mythril
parent
dd5c4fb7a6
commit
d5242df5cf
@ -0,0 +1,19 @@ |
||||
import unittest |
||||
import os |
||||
from subprocess import check_output |
||||
|
||||
|
||||
class CommandLineToolTestCase(unittest.TestCase): |
||||
|
||||
def runTest(self): |
||||
|
||||
script_path = os.path.dirname(os.path.realpath(__file__)) |
||||
myth = os.path.join(script_path, '..', 'myth') |
||||
|
||||
out = check_output([myth,'-d','-c', '0x5050']).decode("UTF-8") |
||||
|
||||
self.assertEqual('0 POP\n1 POP\n', out) |
||||
|
||||
out = check_output([myth,'-d', os.path.join(script_path,'testdata','metacoin.sol')]).decode("UTF-8") |
||||
|
||||
self.assertIn('0 PUSH1 0x60\n2 PUSH1 0x40', out) |
@ -0,0 +1,15 @@ |
||||
pragma solidity ^0.4.17; |
||||
|
||||
contract metaCoin { |
||||
mapping (address => uint) public balances; |
||||
function metaCoin() public { |
||||
balances[msg.sender] = 10000; |
||||
} |
||||
|
||||
function sendToken(address receiver, uint amount) public returns(bool successful){ |
||||
if (balances[msg.sender] < amount) return false; |
||||
balances[msg.sender] -= amount; |
||||
balances[receiver] += amount; |
||||
return false; |
||||
} |
||||
} |
Loading…
Reference in new issue