aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorchriseth <c@ethdev.com>2015-04-17 21:26:16 +0800
committerchriseth <c@ethdev.com>2015-04-17 21:26:16 +0800
commit7571971ca05fd12e3603531044e094ffc0000fb2 (patch)
treec591f0d54a12255f624d0c747ff113dcb41481cc
parentfbf48b6501384c869ec7860508f081745601a96a (diff)
parentd0470999b225bf8b54fdaf9a63062079df996d4f (diff)
downloaddexon-solidity-7571971ca05fd12e3603531044e094ffc0000fb2.tar
dexon-solidity-7571971ca05fd12e3603531044e094ffc0000fb2.tar.gz
dexon-solidity-7571971ca05fd12e3603531044e094ffc0000fb2.tar.bz2
dexon-solidity-7571971ca05fd12e3603531044e094ffc0000fb2.tar.lz
dexon-solidity-7571971ca05fd12e3603531044e094ffc0000fb2.tar.xz
dexon-solidity-7571971ca05fd12e3603531044e094ffc0000fb2.tar.zst
dexon-solidity-7571971ca05fd12e3603531044e094ffc0000fb2.zip
Merge pull request #1654 from chriseth/sol_fix_smallNegativeStorageValues
Fix for small negative storage values.
-rw-r--r--SolidityEndToEndTest.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/SolidityEndToEndTest.cpp b/SolidityEndToEndTest.cpp
index 0d7a933b..3764949d 100644
--- a/SolidityEndToEndTest.cpp
+++ b/SolidityEndToEndTest.cpp
@@ -3676,6 +3676,29 @@ BOOST_AUTO_TEST_CASE(packed_storage_structs_with_bytes0)
BOOST_CHECK(callContractFunction("test()") == encodeArgs(true));
}
+BOOST_AUTO_TEST_CASE(packed_storage_signed)
+{
+ char const* sourceCode = R"(
+ contract C {
+ int8 a;
+ uint8 b;
+ int8 c;
+ uint8 d;
+ function test() returns (uint x1, uint x2, uint x3, uint x4) {
+ a = -2;
+ b = -uint8(a) * 2;
+ c = a * int8(120) * int8(121);
+ x1 = uint(a);
+ x2 = b;
+ x3 = uint(c);
+ x4 = d;
+ }
+ }
+ )";
+ compileAndRun(sourceCode);
+ BOOST_CHECK( callContractFunction("test()") == encodeArgs(u256(-2), u256(4), u256(-112), u256(0)));
+}
+
BOOST_AUTO_TEST_SUITE_END()
}