diff --git a/tests/__init__.py b/tests/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/tests/asm_test.py b/tests/asm_test.py new file mode 100644 index 00000000..10e61596 --- /dev/null +++ b/tests/asm_test.py @@ -0,0 +1 @@ +import unittest diff --git a/tests/contractstorage_test.py b/tests/contractstorage_test.py new file mode 100644 index 00000000..61823670 --- /dev/null +++ b/tests/contractstorage_test.py @@ -0,0 +1,26 @@ +import unittest +from mythril.ether.contractstorage import get_persistent_storage +import os + + +class GetAndSearchContractTestCase(unittest.TestCase): + + def mockCallback(self, code_hash, code, addresses, balances): + self.isFound = True + pass + + def runTest(self): + + script_path = os.path.dirname(os.path.realpath(__file__)) + storage_dir = os.path.join(script_path, 'teststorage') + storage = get_persistent_storage(storage_dir) + + contract = storage.get_contract_by_hash(bytes.fromhex("ea061445eacbe86b7ffed2bb9e52075e")) + + self.assertTrue("0x60606040" in contract.code,'error reading contract code from database') + + self.isFound = False + + storage.search("code#PUSH1#", self.mockCallback) + + self.assertTrue(self.isFound,'storage search error') diff --git a/tests/ethcontract_test.py b/tests/ethcontract_test.py new file mode 100644 index 00000000..c5c2eee9 --- /dev/null +++ b/tests/ethcontract_test.py @@ -0,0 +1,2 @@ +import unittest + diff --git a/tests/evm_test.py b/tests/evm_test.py new file mode 100644 index 00000000..c5c2eee9 --- /dev/null +++ b/tests/evm_test.py @@ -0,0 +1,2 @@ +import unittest + diff --git a/tests/rpc_test.py b/tests/rpc_test.py new file mode 100644 index 00000000..c5c2eee9 --- /dev/null +++ b/tests/rpc_test.py @@ -0,0 +1,2 @@ +import unittest + diff --git a/tests/teststorage/contractstorage.fs b/tests/teststorage/contractstorage.fs new file mode 100644 index 00000000..a3c11318 Binary files /dev/null and b/tests/teststorage/contractstorage.fs differ diff --git a/tests/teststorage/contractstorage.fs.index b/tests/teststorage/contractstorage.fs.index new file mode 100644 index 00000000..cb464437 Binary files /dev/null and b/tests/teststorage/contractstorage.fs.index differ diff --git a/tests/teststorage/contractstorage.fs.lock b/tests/teststorage/contractstorage.fs.lock new file mode 100644 index 00000000..e002abb8 --- /dev/null +++ b/tests/teststorage/contractstorage.fs.lock @@ -0,0 +1 @@ + 69453 diff --git a/tests/teststorage/contractstorage.fs.tmp b/tests/teststorage/contractstorage.fs.tmp new file mode 100644 index 00000000..e69de29b diff --git a/tests/util_test.py b/tests/util_test.py new file mode 100644 index 00000000..c5c2eee9 --- /dev/null +++ b/tests/util_test.py @@ -0,0 +1,2 @@ +import unittest +