aboutsummaryrefslogtreecommitdiffstats
path: root/test/libsolidity/GasMeter.cpp
diff options
context:
space:
mode:
authorchriseth <chris@ethereum.org>2018-04-12 00:30:20 +0800
committerAlex Beregszaszi <alex@rtfs.hu>2018-04-12 02:42:34 +0800
commit928ce088456987431143262dcde2d02553b68192 (patch)
tree6c5ca27bac6d81d7df19ce27e662de08edf1da9f /test/libsolidity/GasMeter.cpp
parentd50d1f0ac1841a1d287a216451e93573fc07474e (diff)
downloaddexon-solidity-928ce088456987431143262dcde2d02553b68192.tar
dexon-solidity-928ce088456987431143262dcde2d02553b68192.tar.gz
dexon-solidity-928ce088456987431143262dcde2d02553b68192.tar.bz2
dexon-solidity-928ce088456987431143262dcde2d02553b68192.tar.lz
dexon-solidity-928ce088456987431143262dcde2d02553b68192.tar.xz
dexon-solidity-928ce088456987431143262dcde2d02553b68192.tar.zst
dexon-solidity-928ce088456987431143262dcde2d02553b68192.zip
Correctly ignore costs of fallback for other functions.
Diffstat (limited to 'test/libsolidity/GasMeter.cpp')
-rw-r--r--test/libsolidity/GasMeter.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/test/libsolidity/GasMeter.cpp b/test/libsolidity/GasMeter.cpp
index fd2017f9..0d66456c 100644
--- a/test/libsolidity/GasMeter.cpp
+++ b/test/libsolidity/GasMeter.cpp
@@ -294,6 +294,19 @@ BOOST_AUTO_TEST_CASE(extcodesize_gas)
testRunTimeGas("f()", vector<bytes>{encodeArgs()});
}
+BOOST_AUTO_TEST_CASE(regular_functions_exclude_fallback)
+{
+ // A bug in the estimator caused the costs for a specific function
+ // to always include the costs for the fallback.
+ char const* sourceCode = R"(
+ contract A {
+ uint public x;
+ function() { x = 2; }
+ }
+ )";
+ testCreationTimeGas(sourceCode);
+ testRunTimeGas("x()", vector<bytes>{encodeArgs()});
+}
BOOST_AUTO_TEST_SUITE_END()
}