diff options
author | Alex Beregszaszi <alex@rtfs.hu> | 2017-02-12 22:07:52 +0800 |
---|---|---|
committer | Alex Beregszaszi <alex@rtfs.hu> | 2017-02-24 08:18:18 +0800 |
commit | cde027d144643883106d8bcef034c9e8ace2b3b2 (patch) | |
tree | d1d76b06abc7b30e79c7572c7eaa5d6ab20a9fbf /test/libsolidity/SolidityEndToEndTest.cpp | |
parent | c46c68dfd8a5a8d82c19335c20d2bfa3aa8dd9ec (diff) | |
download | dexon-solidity-cde027d144643883106d8bcef034c9e8ace2b3b2.tar.gz dexon-solidity-cde027d144643883106d8bcef034c9e8ace2b3b2.tar.zst dexon-solidity-cde027d144643883106d8bcef034c9e8ace2b3b2.zip |
Fix test for gas overloading in .transfer()
Diffstat (limited to 'test/libsolidity/SolidityEndToEndTest.cpp')
-rw-r--r-- | test/libsolidity/SolidityEndToEndTest.cpp | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/test/libsolidity/SolidityEndToEndTest.cpp b/test/libsolidity/SolidityEndToEndTest.cpp index 30430aef..f77a8935 100644 --- a/test/libsolidity/SolidityEndToEndTest.cpp +++ b/test/libsolidity/SolidityEndToEndTest.cpp @@ -1707,11 +1707,22 @@ BOOST_AUTO_TEST_CASE(transfer_ether) throw; } } + + contract D { + // This takes about ~3600 gas, which exceeds the 2300 gas stipend. + function () payable { + bytes32 tmp = 1; + for (uint i = 0; i < 20; i++) + tmp = sha3(tmp); + } + } )"; compileAndRun(sourceCode, 0, "B"); u160 const nonPayableRecipient = m_contractAddress; compileAndRun(sourceCode, 0, "C"); u160 const oogRecipient = m_contractAddress; + compileAndRun(sourceCode, 0, "D"); + u160 const expensiveRecipient = m_contractAddress; compileAndRun(sourceCode, 20, "A"); u160 payableRecipient(23); BOOST_CHECK(callContractFunction("a(address,uint256)", payableRecipient, 10) == encodeArgs(10)); @@ -1719,8 +1730,8 @@ BOOST_AUTO_TEST_CASE(transfer_ether) BOOST_CHECK_EQUAL(balanceAt(m_contractAddress), 10); BOOST_CHECK(callContractFunction("b(address,uint256)", nonPayableRecipient, 10) == encodeArgs()); BOOST_CHECK(callContractFunction("b(address,uint256)", oogRecipient, 10) == encodeArgs()); - BOOST_CHECK(callContractFunction("c(address,uint256,uint256)", payableRecipient, 1, 9000) == encodeArgs(9)); - BOOST_CHECK(callContractFunction("c(address,uint256,uint256)", payableRecipient, 1, 0) == encodeArgs()); + BOOST_CHECK(callContractFunction("c(address,uint256,uint256)", expensiveRecipient, 1, 9000) == encodeArgs(9)); + BOOST_CHECK(callContractFunction("c(address,uint256,uint256)", expensiveRecipient, 1, 0) == encodeArgs()); } BOOST_AUTO_TEST_CASE(log0) |