aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCJentzsch <jentzsch.software@gmail.com>2015-01-13 22:47:36 +0800
committerCJentzsch <jentzsch.software@gmail.com>2015-01-13 22:47:36 +0800
commit108388c4401ce16609bfc23c4dcb6b3e09638e02 (patch)
tree6489941b4c772ef8c80f0310d8c7a0bda5d9c966
parent22d738b9955389a5cea73e60fde09b9dc681c91d (diff)
downloaddexon-solidity-108388c4401ce16609bfc23c4dcb6b3e09638e02.tar
dexon-solidity-108388c4401ce16609bfc23c4dcb6b3e09638e02.tar.gz
dexon-solidity-108388c4401ce16609bfc23c4dcb6b3e09638e02.tar.bz2
dexon-solidity-108388c4401ce16609bfc23c4dcb6b3e09638e02.tar.lz
dexon-solidity-108388c4401ce16609bfc23c4dcb6b3e09638e02.tar.xz
dexon-solidity-108388c4401ce16609bfc23c4dcb6b3e09638e02.tar.zst
dexon-solidity-108388c4401ce16609bfc23c4dcb6b3e09638e02.zip
fix callcreates imoport
-rw-r--r--TestHelper.cpp13
-rw-r--r--TestHelper.h2
-rw-r--r--vm.cpp7
3 files changed, 19 insertions, 3 deletions
diff --git a/TestHelper.cpp b/TestHelper.cpp
index ff330d60..355a5080 100644
--- a/TestHelper.cpp
+++ b/TestHelper.cpp
@@ -350,6 +350,19 @@ void checkLog(LogEntries _resultLogs, LogEntries _expectedLogs)
}
}
+void checkCallCreates(eth::Transactions _resultCallCreates, eth::Transactions _expectedCallCreates)
+{
+ BOOST_REQUIRE_EQUAL(_resultCallCreates.size(), _expectedCallCreates.size());
+
+ for (size_t i = 0; i < _resultCallCreates.size(); ++i)
+ {
+ BOOST_CHECK(_resultCallCreates[i].data() == _expectedCallCreates[i].data());
+ BOOST_CHECK(_resultCallCreates[i].receiveAddress() == _expectedCallCreates[i].receiveAddress());
+ BOOST_CHECK(_resultCallCreates[i].gas() == _expectedCallCreates[i].gas());
+ BOOST_CHECK(_resultCallCreates[i].value() == _expectedCallCreates[i].value());
+ }
+}
+
std::string getTestPath()
{
string testPath;
diff --git a/TestHelper.h b/TestHelper.h
index 85017c84..2ef5c6d5 100644
--- a/TestHelper.h
+++ b/TestHelper.h
@@ -73,6 +73,8 @@ json_spirit::mArray exportLog(eth::LogEntries _logs);
void checkOutput(bytes const& _output, json_spirit::mObject& _o);
void checkStorage(std::map<u256, u256> _expectedStore, std::map<u256, u256> _resultStore, Address _expectedAddr);
void checkLog(eth::LogEntries _resultLogs, eth::LogEntries _expectedLogs);
+void checkCallCreates(eth::Transactions _resultCallCreates, eth::Transactions _expectedCallCreates);
+
void executeTests(const std::string& _name, const std::string& _testPathAppendix, std::function<void(json_spirit::mValue&, bool)> doTests);
std::string getTestPath();
void userDefinedTest(std::string testTypeFlag, std::function<void(json_spirit::mValue&, bool)> doTests);
diff --git a/vm.cpp b/vm.cpp
index 8b8c75a0..8af752ca 100644
--- a/vm.cpp
+++ b/vm.cpp
@@ -237,8 +237,8 @@ void FakeExtVM::importCallCreates(mArray& _callcreates)
BOOST_REQUIRE(tx.count("destination") > 0);
BOOST_REQUIRE(tx.count("gasLimit") > 0);
Transaction t = tx["destination"].get_str().empty() ?
- Transaction(toInt(tx["value"]), 0, toInt(tx["gasLimit"]), data.toBytes()) :
- Transaction(toInt(tx["value"]), 0, toInt(tx["gasLimit"]), Address(tx["destination"].get_str()), data.toBytes());
+ Transaction(toInt(tx["value"]), 0, toInt(tx["gasLimit"]), fromHex(tx["data"].get_str())) :
+ Transaction(toInt(tx["value"]), 0, toInt(tx["gasLimit"]), Address(tx["destination"].get_str()), fromHex(tx["data"].get_str()));
callcreates.push_back(t);
}
}
@@ -448,7 +448,8 @@ void doVMTests(json_spirit::mValue& v, bool _fillin)
}
checkAddresses<std::map<Address, std::tuple<u256, u256, std::map<u256, u256>, bytes> > >(test.addresses, fev.addresses);
- BOOST_CHECK(test.callcreates == fev.callcreates);
+
+ checkCallCreates(fev.callcreates, test.callcreates);
checkLog(fev.sub.logs, test.sub.logs);
}