aboutsummaryrefslogtreecommitdiffstats
path: root/state.cpp
diff options
context:
space:
mode:
authorCJentzsch <jentzsch.software@gmail.com>2015-01-07 03:57:33 +0800
committerCJentzsch <jentzsch.software@gmail.com>2015-01-07 03:57:33 +0800
commita8d472f5ab83cc7e11cf838e335b8b26f658927b (patch)
treec8e51e41df93a704139f4e3b52b04ca9baa942d3 /state.cpp
parentecf3c0bb324b328b562408a5605aa33c6bfca9f4 (diff)
downloaddexon-solidity-a8d472f5ab83cc7e11cf838e335b8b26f658927b.tar.gz
dexon-solidity-a8d472f5ab83cc7e11cf838e335b8b26f658927b.tar.zst
dexon-solidity-a8d472f5ab83cc7e11cf838e335b8b26f658927b.zip
Blockhash tests
Diffstat (limited to 'state.cpp')
-rw-r--r--state.cpp15
1 files changed, 14 insertions, 1 deletions
diff --git a/state.cpp b/state.cpp
index 13346822..db8350e4 100644
--- a/state.cpp
+++ b/state.cpp
@@ -39,6 +39,14 @@ using namespace dev::eth;
namespace dev { namespace test {
+LastHashes lastHashes(u256 _currentBlockNumber)
+{
+ LastHashes ret;
+ for (u256 i = 1; i <= 256 && i <= _currentBlockNumber; ++i)
+ ret.push_back(sha3(toString(_currentBlockNumber - i)));
+ return ret;
+}
+
void doStateTests(json_spirit::mValue& v, bool _fillin)
@@ -62,7 +70,7 @@ void doStateTests(json_spirit::mValue& v, bool _fillin)
try
{
- theState.execute(LastHashes(), tx, &output);
+ theState.execute(lastHashes(importer.m_environment.currentBlock.number), tx, &output);
}
catch (Exception const& _e)
{
@@ -157,6 +165,11 @@ BOOST_AUTO_TEST_CASE(stRefundTest)
dev::test::executeTests("stRefundTest", "/StateTests", dev::test::doStateTests);
}
+BOOST_AUTO_TEST_CASE(stBlockHashTest)
+{
+ dev::test::executeTests("stBlockHashTest", "/StateTests", dev::test::doStateTests);
+}
+
BOOST_AUTO_TEST_CASE(stCreateTest)
{
for (int i = 1; i < boost::unit_test::framework::master_test_suite().argc; ++i)