aboutsummaryrefslogtreecommitdiffstats
path: root/test/libsolidity
diff options
context:
space:
mode:
authorchriseth <chris@ethereum.org>2017-04-26 20:29:54 +0800
committerGitHub <noreply@github.com>2017-04-26 20:29:54 +0800
commit3cbdf6d490c6871d58f12f877cdc84111a7325c1 (patch)
tree10c53b37db2275d9b6b220bb572ceca777e20297 /test/libsolidity
parentc3b839ca751bd11a5881fea1db1cfa92ec468d16 (diff)
parentefa9c7626718023083489aebee9a1662c5f24ab5 (diff)
downloaddexon-solidity-3cbdf6d490c6871d58f12f877cdc84111a7325c1.tar
dexon-solidity-3cbdf6d490c6871d58f12f877cdc84111a7325c1.tar.gz
dexon-solidity-3cbdf6d490c6871d58f12f877cdc84111a7325c1.tar.bz2
dexon-solidity-3cbdf6d490c6871d58f12f877cdc84111a7325c1.tar.lz
dexon-solidity-3cbdf6d490c6871d58f12f877cdc84111a7325c1.tar.xz
dexon-solidity-3cbdf6d490c6871d58f12f877cdc84111a7325c1.tar.zst
dexon-solidity-3cbdf6d490c6871d58f12f877cdc84111a7325c1.zip
Merge pull request #1577 from ethereum/gas_table
Gas table update
Diffstat (limited to 'test/libsolidity')
-rw-r--r--test/libsolidity/GasMeter.cpp45
1 files changed, 45 insertions, 0 deletions
diff --git a/test/libsolidity/GasMeter.cpp b/test/libsolidity/GasMeter.cpp
index 0671fb15..f90cb105 100644
--- a/test/libsolidity/GasMeter.cpp
+++ b/test/libsolidity/GasMeter.cpp
@@ -248,6 +248,51 @@ BOOST_AUTO_TEST_CASE(multiple_external_functions)
testRunTimeGas("g(uint256)", vector<bytes>{encodeArgs(2)});
}
+BOOST_AUTO_TEST_CASE(exponent_size)
+{
+ char const* sourceCode = R"(
+ contract A {
+ function g(uint x) returns (uint) {
+ return x ** 0x100;
+ }
+ function h(uint x) returns (uint) {
+ return x ** 0x10000;
+ }
+ }
+ )";
+ testCreationTimeGas(sourceCode);
+ testRunTimeGas("g(uint256)", vector<bytes>{encodeArgs(2)});
+ testRunTimeGas("h(uint256)", vector<bytes>{encodeArgs(2)});
+}
+
+BOOST_AUTO_TEST_CASE(balance_gas)
+{
+ char const* sourceCode = R"(
+ contract A {
+ function lookup_balance(address a) returns (uint) {
+ return a.balance;
+ }
+ }
+ )";
+ testCreationTimeGas(sourceCode);
+ testRunTimeGas("lookup_balance(address)", vector<bytes>{encodeArgs(2), encodeArgs(100)});
+}
+
+BOOST_AUTO_TEST_CASE(extcodesize_gas)
+{
+ char const* sourceCode = R"(
+ contract A {
+ function f() returns (uint _s) {
+ assembly {
+ _s := extcodesize(0x30)
+ }
+ }
+ }
+ )";
+ testCreationTimeGas(sourceCode);
+ testRunTimeGas("f()", vector<bytes>{encodeArgs()});
+}
+
BOOST_AUTO_TEST_SUITE_END()
}