From 8387d0df83b7eceff6f6af2845f34cac71f848f4 Mon Sep 17 00:00:00 2001 From: Yoichi Hirai Date: Thu, 5 Jan 2017 14:08:55 +0100 Subject: test: add a test about gas costs of EXP --- test/libsolidity/GasMeter.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'test') diff --git a/test/libsolidity/GasMeter.cpp b/test/libsolidity/GasMeter.cpp index 0671fb15..3f06cb85 100644 --- a/test/libsolidity/GasMeter.cpp +++ b/test/libsolidity/GasMeter.cpp @@ -248,6 +248,23 @@ BOOST_AUTO_TEST_CASE(multiple_external_functions) testRunTimeGas("g(uint256)", vector{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("f(uint256)", vector{encodeArgs(2)}); + testRunTimeGas("g(uint256)", vector{encodeArgs(2)}); +} + BOOST_AUTO_TEST_SUITE_END() } -- cgit