mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Add test case for gas metering of exp(n, 0)
This commit is contained in:
parent
00f3c42d17
commit
004f01a388
@ -261,6 +261,9 @@ BOOST_AUTO_TEST_CASE(exponent_size)
|
|||||||
{
|
{
|
||||||
char const* sourceCode = R"(
|
char const* sourceCode = R"(
|
||||||
contract A {
|
contract A {
|
||||||
|
function f(uint x) public returns (uint) {
|
||||||
|
return x ** 0;
|
||||||
|
}
|
||||||
function g(uint x) public returns (uint) {
|
function g(uint x) public returns (uint) {
|
||||||
return x ** 0x100;
|
return x ** 0x100;
|
||||||
}
|
}
|
||||||
@ -270,6 +273,7 @@ BOOST_AUTO_TEST_CASE(exponent_size)
|
|||||||
}
|
}
|
||||||
)";
|
)";
|
||||||
testCreationTimeGas(sourceCode);
|
testCreationTimeGas(sourceCode);
|
||||||
|
testRunTimeGas("f(uint256)", vector<bytes>{encodeArgs(2)});
|
||||||
testRunTimeGas("g(uint256)", vector<bytes>{encodeArgs(2)});
|
testRunTimeGas("g(uint256)", vector<bytes>{encodeArgs(2)});
|
||||||
testRunTimeGas("h(uint256)", vector<bytes>{encodeArgs(2)});
|
testRunTimeGas("h(uint256)", vector<bytes>{encodeArgs(2)});
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user