aboutsummaryrefslogtreecommitdiffstats
path: root/test/libsolidity/SolidityEndToEndTest.cpp
diff options
context:
space:
mode:
authorchriseth <chris@ethereum.org>2018-04-16 19:10:50 +0800
committerGitHub <noreply@github.com>2018-04-16 19:10:50 +0800
commit533d08517f37496295e213194b489cd6ed15432b (patch)
tree936f79a7f70bd3b970a86463106ac87808bf8721 /test/libsolidity/SolidityEndToEndTest.cpp
parent8be19ad72bbdd7c934003c7d338f5511b6786921 (diff)
parent33fbf88707e69362bd5b6336860827a7b4d74440 (diff)
downloaddexon-solidity-533d08517f37496295e213194b489cd6ed15432b.tar.gz
dexon-solidity-533d08517f37496295e213194b489cd6ed15432b.tar.zst
dexon-solidity-533d08517f37496295e213194b489cd6ed15432b.zip
Merge pull request #3793 from ethereum/rationalNumberLimit
Rational number limit
Diffstat (limited to 'test/libsolidity/SolidityEndToEndTest.cpp')
-rw-r--r--test/libsolidity/SolidityEndToEndTest.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/test/libsolidity/SolidityEndToEndTest.cpp b/test/libsolidity/SolidityEndToEndTest.cpp
index cbeca215..8440449c 100644
--- a/test/libsolidity/SolidityEndToEndTest.cpp
+++ b/test/libsolidity/SolidityEndToEndTest.cpp
@@ -102,6 +102,29 @@ BOOST_AUTO_TEST_CASE(exp_operator_const_signed)
ABI_CHECK(callContractFunction("f()", bytes()), toBigEndian(u256(-8)));
}
+BOOST_AUTO_TEST_CASE(exp_zero)
+{
+ char const* sourceCode = R"(
+ contract test {
+ function f(uint a) returns(uint d) { return a ** 0; }
+ }
+ )";
+ compileAndRun(sourceCode);
+ testContractAgainstCppOnRange("f(uint256)", [](u256 const&) -> u256 { return u256(1); }, 0, 16);
+}
+
+BOOST_AUTO_TEST_CASE(exp_zero_literal)
+{
+ char const* sourceCode = R"(
+ contract test {
+ function f() returns(uint d) { return 0 ** 0; }
+ }
+ )";
+ compileAndRun(sourceCode);
+ ABI_CHECK(callContractFunction("f()", bytes()), toBigEndian(u256(1)));
+}
+
+
BOOST_AUTO_TEST_CASE(conditional_expression_true_literal)
{
char const* sourceCode = R"(