mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Adds unit tests for moved function.
This commit is contained in:
committed by
Alex Beregszaszi
parent
ed632025fe
commit
be35a65eb3
@@ -1805,6 +1805,35 @@ BOOST_AUTO_TEST_CASE(uncalled_blockhash)
|
||||
BOOST_CHECK(result[0] != 0 || result[1] != 0 || result[2] != 0);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(blockhash_global_level)
|
||||
{
|
||||
char const* sourceCode = R"(
|
||||
contract Test {
|
||||
function a() public returns (bytes32) {
|
||||
return blockhash(0);
|
||||
}
|
||||
}
|
||||
)";
|
||||
compileAndRun(sourceCode);
|
||||
BOOST_CHECK(!callContractFunction("a()").empty());
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(blockhash_shadow)
|
||||
{
|
||||
char const* sourceCode = R"(
|
||||
contract Test {
|
||||
function blockhash(uint256 blockNumber) public returns (bytes32) {
|
||||
return "abc";
|
||||
}
|
||||
function f() returns (bytes32) {
|
||||
return blockhash(3);
|
||||
}
|
||||
}
|
||||
)";
|
||||
compileAndRun(sourceCode);
|
||||
BOOST_REQUIRE(callContractFunction("f()") != encodeArgs("abc"));
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(log0)
|
||||
{
|
||||
char const* sourceCode = R"(
|
||||
|
||||
Reference in New Issue
Block a user