Update unit test

pull/22/head
Bernhard Mueller 7 years ago
parent 8b44c79990
commit 3d76f4e15f
  1. 2
      myth
  2. 4
      mythril/disassembler/callgraph.py
  3. 2
      tests/svm_test.py

@ -203,7 +203,7 @@ elif (args.graph) or (args.fire_lasers):
if args.enable_physics is not None: if args.enable_physics is not None:
physics = True physics = True
html = generate_callgraph(modules, args.enable_physics) html = generate_callgraph(modules, contracts[0].address, args.enable_physics)
try: try:
with open(args.graph, "w") as f: with open(args.graph, "w") as f:

@ -130,11 +130,11 @@ def serialize(_svm, color_map):
def generate_callgraph(modules, physics): def generate_callgraph(modules, main_address, physics):
_svm = svm.SVM(modules) _svm = svm.SVM(modules)
_svm.sym_exec() _svm.sym_exec(main_address)
i = 0 i = 0

@ -11,6 +11,6 @@ class SVMTestCase(unittest.TestCase):
modules['0x0000000000000000000000000000000000000000'] = {'name': 'metaCoin', 'address': '0x0000000000000000000000000000000000000000', 'creation_code': '', 'code': '60606040526004361061004c576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806327e235e314610051578063412664ae1461009e575b600080fd5b341561005c57600080fd5b610088600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506100f8565b6040518082815260200191505060405180910390f35b34156100a957600080fd5b6100de600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610110565b604051808215151515815260200191505060405180910390f35b60006020528060005260406000206000915090505481565b6000816000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101561016157600090506101fe565b816000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540392505081905550816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540192505081905550600090505b929150505600a165627a7a72305820fd4fa106da498514e90965a45ffecc1da53a0cd8bb7a7135910f8612245a46370029'} modules['0x0000000000000000000000000000000000000000'] = {'name': 'metaCoin', 'address': '0x0000000000000000000000000000000000000000', 'creation_code': '', 'code': '60606040526004361061004c576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806327e235e314610051578063412664ae1461009e575b600080fd5b341561005c57600080fd5b610088600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506100f8565b6040518082815260200191505060405180910390f35b34156100a957600080fd5b6100de600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610110565b604051808215151515815260200191505060405180910390f35b60006020528060005260406000206000915090505481565b6000816000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101561016157600090506101fe565b816000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540392505081905550816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540192505081905550600090505b929150505600a165627a7a72305820fd4fa106da498514e90965a45ffecc1da53a0cd8bb7a7135910f8612245a46370029'}
modules['0x0000000000000000000000000000000000000000']['disassembly'] = Disassembly(modules['0x0000000000000000000000000000000000000000']['code']) modules['0x0000000000000000000000000000000000000000']['disassembly'] = Disassembly(modules['0x0000000000000000000000000000000000000000']['code'])
html = generate_callgraph(modules, False) html = generate_callgraph(modules, '0x0000000000000000000000000000000000000000', False)
self.assertTrue("var nodes = [\n{id: \'metaCoin:" in html) self.assertTrue("var nodes = [\n{id: \'metaCoin:" in html)

Loading…
Cancel
Save