aboutsummaryrefslogtreecommitdiffstats
path: root/test/libsolidity/SolidityEndToEndTest.cpp
diff options
context:
space:
mode:
authorbitshift <bitshift@posteo.org>2018-03-06 02:24:33 +0800
committerAlex Beregszaszi <alex@rtfs.hu>2018-03-27 10:30:03 +0800
commitbe35a65eb3966965e30b6b582f7722338e558013 (patch)
tree4784a52616f22bf96a388af7591ead908bad4617 /test/libsolidity/SolidityEndToEndTest.cpp
parented632025fe5995d093472b1e7660087e943f2ca6 (diff)
downloaddexon-solidity-be35a65eb3966965e30b6b582f7722338e558013.tar.gz
dexon-solidity-be35a65eb3966965e30b6b582f7722338e558013.tar.zst
dexon-solidity-be35a65eb3966965e30b6b582f7722338e558013.zip
Adds unit tests for moved function.
Diffstat (limited to 'test/libsolidity/SolidityEndToEndTest.cpp')
-rw-r--r--test/libsolidity/SolidityEndToEndTest.cpp29
1 files changed, 29 insertions, 0 deletions
diff --git a/test/libsolidity/SolidityEndToEndTest.cpp b/test/libsolidity/SolidityEndToEndTest.cpp
index 44dc40f7..43d390f5 100644
--- a/test/libsolidity/SolidityEndToEndTest.cpp
+++ b/test/libsolidity/SolidityEndToEndTest.cpp
@@ -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"(