aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorchriseth <chris@ethereum.org>2018-10-19 01:02:35 +0800
committerGitHub <noreply@github.com>2018-10-19 01:02:35 +0800
commit4987c12ac3fa16daec6df090a422890ef2823ff4 (patch)
treefbeeedd368f1ee01ff9ce9f20b6879276dd26c5b
parent7dffb0f3eecdd1dac75482db2c59207ded7a2dfa (diff)
parent134f5cb7985965c9fb5756979b4912153f043062 (diff)
downloaddexon-solidity-4987c12ac3fa16daec6df090a422890ef2823ff4.tar
dexon-solidity-4987c12ac3fa16daec6df090a422890ef2823ff4.tar.gz
dexon-solidity-4987c12ac3fa16daec6df090a422890ef2823ff4.tar.bz2
dexon-solidity-4987c12ac3fa16daec6df090a422890ef2823ff4.tar.lz
dexon-solidity-4987c12ac3fa16daec6df090a422890ef2823ff4.tar.xz
dexon-solidity-4987c12ac3fa16daec6df090a422890ef2823ff4.tar.zst
dexon-solidity-4987c12ac3fa16daec6df090a422890ef2823ff4.zip
Merge pull request #5213 from Mordax/issue-5103
Tests for flipping signs on signed type edge case
-rw-r--r--test/libsolidity/SolidityEndToEndTest.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/test/libsolidity/SolidityEndToEndTest.cpp b/test/libsolidity/SolidityEndToEndTest.cpp
index 7a496e64..133387c8 100644
--- a/test/libsolidity/SolidityEndToEndTest.cpp
+++ b/test/libsolidity/SolidityEndToEndTest.cpp
@@ -14010,6 +14010,21 @@ BOOST_AUTO_TEST_CASE(test_underscore_in_hex)
ABI_CHECK(callContractFunction("f(bool)", false), encodeArgs(u256(0x1234abcd1234)));
}
+BOOST_AUTO_TEST_CASE(flipping_sign_tests)
+{
+ char const* sourceCode = R"(
+ contract test {
+ function f() public returns (bool){
+ int x = -2**255;
+ assert(-x == x);
+ return true;
+ }
+ }
+ )";
+ compileAndRun(sourceCode);
+ ABI_CHECK(callContractFunction("f()"), encodeArgs(true));
+}
+
BOOST_AUTO_TEST_SUITE_END()
}