aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorAlex Beregszaszi <alex@rtfs.hu>2017-08-01 03:54:54 +0800
committerAlex Beregszaszi <alex@rtfs.hu>2017-08-02 03:55:01 +0800
commitb7642dc8a7ef54abf6f37fddefc118ca1108b0ae (patch)
treea159819f12c1fd3d042759928843855f05f79e24 /test
parent3aacfc7e3569b27ca97dce41d886bbc3043546e0 (diff)
downloaddexon-solidity-b7642dc8a7ef54abf6f37fddefc118ca1108b0ae.tar
dexon-solidity-b7642dc8a7ef54abf6f37fddefc118ca1108b0ae.tar.gz
dexon-solidity-b7642dc8a7ef54abf6f37fddefc118ca1108b0ae.tar.bz2
dexon-solidity-b7642dc8a7ef54abf6f37fddefc118ca1108b0ae.tar.lz
dexon-solidity-b7642dc8a7ef54abf6f37fddefc118ca1108b0ae.tar.xz
dexon-solidity-b7642dc8a7ef54abf6f37fddefc118ca1108b0ae.tar.zst
dexon-solidity-b7642dc8a7ef54abf6f37fddefc118ca1108b0ae.zip
Disallow gas modifier on sha255/ripemd160/ecrecover
Diffstat (limited to 'test')
-rw-r--r--test/libsolidity/SolidityEndToEndTest.cpp15
-rw-r--r--test/libsolidity/SolidityNameAndTypeResolution.cpp24
2 files changed, 24 insertions, 15 deletions
diff --git a/test/libsolidity/SolidityEndToEndTest.cpp b/test/libsolidity/SolidityEndToEndTest.cpp
index 2c9dfad9..a972cc86 100644
--- a/test/libsolidity/SolidityEndToEndTest.cpp
+++ b/test/libsolidity/SolidityEndToEndTest.cpp
@@ -2399,21 +2399,6 @@ BOOST_AUTO_TEST_CASE(gas_and_value_basic)
BOOST_REQUIRE(callContractFunction("checkState()") == encodeArgs(false, 20 - 5));
}
-BOOST_AUTO_TEST_CASE(gas_for_builtin)
-{
- char const* sourceCode = R"(
- contract Contract {
- function test(uint g) returns (bytes32 data, bool flag) {
- data = ripemd160.gas(g)("abc");
- flag = true;
- }
- }
- )";
- compileAndRun(sourceCode);
- BOOST_CHECK(callContractFunction("test(uint256)", 500) == bytes());
- BOOST_CHECK(callContractFunction("test(uint256)", 800) == encodeArgs(u256("0x8eb208f7e05d987a9b044a8e98c6b087f15a0bfc000000000000000000000000"), true));
-}
-
BOOST_AUTO_TEST_CASE(value_complex)
{
char const* sourceCode = R"(
diff --git a/test/libsolidity/SolidityNameAndTypeResolution.cpp b/test/libsolidity/SolidityNameAndTypeResolution.cpp
index e2e9f08a..4fe52243 100644
--- a/test/libsolidity/SolidityNameAndTypeResolution.cpp
+++ b/test/libsolidity/SolidityNameAndTypeResolution.cpp
@@ -6461,6 +6461,30 @@ BOOST_AUTO_TEST_CASE(builtin_reject_gas)
}
)";
CHECK_ERROR(text, TypeError, "Member \"gas\" not found or not visible after argument-dependent lookup");
+ text = R"(
+ contract C {
+ function f() {
+ sha256.gas();
+ }
+ }
+ )";
+ CHECK_ERROR(text, TypeError, "Member \"gas\" not found or not visible after argument-dependent lookup");
+ text = R"(
+ contract C {
+ function f() {
+ ripemd160.gas();
+ }
+ }
+ )";
+ CHECK_ERROR(text, TypeError, "Member \"gas\" not found or not visible after argument-dependent lookup");
+ text = R"(
+ contract C {
+ function f() {
+ ecrecover.gas();
+ }
+ }
+ )";
+ CHECK_ERROR(text, TypeError, "Member \"gas\" not found or not visible after argument-dependent lookup");
}
BOOST_AUTO_TEST_CASE(builtin_reject_value)