Add test case for gas metering of exp(n, 0)

This commit is contained in:
Alex Beregszaszi 2020-01-16 14:34:45 +00:00 committed by Daniel Kirchner
parent 00f3c42d17
commit 004f01a388

View File

@ -261,6 +261,9 @@ BOOST_AUTO_TEST_CASE(exponent_size)
{
char const* sourceCode = R"(
contract A {
function f(uint x) public returns (uint) {
return x ** 0;
}
function g(uint x) public returns (uint) {
return x ** 0x100;
}
@ -270,6 +273,7 @@ BOOST_AUTO_TEST_CASE(exponent_size)
}
)";
testCreationTimeGas(sourceCode);
testRunTimeGas("f(uint256)", vector<bytes>{encodeArgs(2)});
testRunTimeGas("g(uint256)", vector<bytes>{encodeArgs(2)});
testRunTimeGas("h(uint256)", vector<bytes>{encodeArgs(2)});
}