aboutsummaryrefslogtreecommitdiffstats
path: root/test/libsolidity
diff options
context:
space:
mode:
authormordax <maya@mordax.io>2018-10-14 08:22:39 +0800
committermordax <maya@mordax.io>2018-10-16 04:08:43 +0800
commit134f5cb7985965c9fb5756979b4912153f043062 (patch)
treed5ef6b517a2401404351eb6c0aaa36c2e8a28ef4 /test/libsolidity
parent036929aba11268eafb602394af8b212fbe56ae6c (diff)
downloaddexon-solidity-134f5cb7985965c9fb5756979b4912153f043062.tar
dexon-solidity-134f5cb7985965c9fb5756979b4912153f043062.tar.gz
dexon-solidity-134f5cb7985965c9fb5756979b4912153f043062.tar.bz2
dexon-solidity-134f5cb7985965c9fb5756979b4912153f043062.tar.lz
dexon-solidity-134f5cb7985965c9fb5756979b4912153f043062.tar.xz
dexon-solidity-134f5cb7985965c9fb5756979b4912153f043062.tar.zst
dexon-solidity-134f5cb7985965c9fb5756979b4912153f043062.zip
Added test for flipping signs on signed type edge case
Diffstat (limited to 'test/libsolidity')
-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()
}