diff options
author | chriseth <chris@ethereum.org> | 2018-03-15 01:04:40 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-03-15 01:04:40 +0800 |
commit | abc7a45230614454d6ffb78447c112b63f712642 (patch) | |
tree | 5a02cbc3ae1416ded068c3e5f21762478c79ab55 /test/libsolidity/SolidityEndToEndTest.cpp | |
parent | 59658afa30f434b3a2501c72d4a033af550462b0 (diff) | |
parent | 834d63de2c4dc9c119862f8bf25b4f7c9f408d6e (diff) | |
download | dexon-solidity-abc7a45230614454d6ffb78447c112b63f712642.tar dexon-solidity-abc7a45230614454d6ffb78447c112b63f712642.tar.gz dexon-solidity-abc7a45230614454d6ffb78447c112b63f712642.tar.bz2 dexon-solidity-abc7a45230614454d6ffb78447c112b63f712642.tar.lz dexon-solidity-abc7a45230614454d6ffb78447c112b63f712642.tar.xz dexon-solidity-abc7a45230614454d6ffb78447c112b63f712642.tar.zst dexon-solidity-abc7a45230614454d6ffb78447c112b63f712642.zip |
Merge pull request #3725 from ethereum/blockhashNoCall
Allow ``block.blockhash`` without it being called.
Diffstat (limited to 'test/libsolidity/SolidityEndToEndTest.cpp')
-rw-r--r-- | test/libsolidity/SolidityEndToEndTest.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/test/libsolidity/SolidityEndToEndTest.cpp b/test/libsolidity/SolidityEndToEndTest.cpp index 282136f7..a080fe71 100644 --- a/test/libsolidity/SolidityEndToEndTest.cpp +++ b/test/libsolidity/SolidityEndToEndTest.cpp @@ -1788,6 +1788,23 @@ BOOST_AUTO_TEST_CASE(transfer_ether) ABI_CHECK(callContractFunction("b(address,uint256)", oogRecipient, 10), encodeArgs()); } +BOOST_AUTO_TEST_CASE(uncalled_blockhash) +{ + char const* code = R"( + contract C { + function f() public view returns (bytes32) + { + var x = block.blockhash; + return x(block.number - 1); + } + } + )"; + compileAndRun(code, 0, "C"); + bytes result = callContractFunction("f()"); + BOOST_REQUIRE_EQUAL(result.size(), 32); + BOOST_CHECK(result[0] != 0 || result[1] != 0 || result[2] != 0); +} + BOOST_AUTO_TEST_CASE(log0) { char const* sourceCode = R"( |