diff options
author | chriseth <c@ethdev.com> | 2015-04-16 23:43:30 +0800 |
---|---|---|
committer | chriseth <c@ethdev.com> | 2015-04-17 19:25:28 +0800 |
commit | d0470999b225bf8b54fdaf9a63062079df996d4f (patch) | |
tree | b546b3edf9248e7657f5e475a13504e4c87bde71 | |
parent | 3c353e2d0ed66117793864977c3de84a371f8d28 (diff) | |
download | dexon-solidity-d0470999b225bf8b54fdaf9a63062079df996d4f.tar dexon-solidity-d0470999b225bf8b54fdaf9a63062079df996d4f.tar.gz dexon-solidity-d0470999b225bf8b54fdaf9a63062079df996d4f.tar.bz2 dexon-solidity-d0470999b225bf8b54fdaf9a63062079df996d4f.tar.lz dexon-solidity-d0470999b225bf8b54fdaf9a63062079df996d4f.tar.xz dexon-solidity-d0470999b225bf8b54fdaf9a63062079df996d4f.tar.zst dexon-solidity-d0470999b225bf8b54fdaf9a63062079df996d4f.zip |
Tests for signed integers in storage.
-rw-r--r-- | SolidityEndToEndTest.cpp | 23 |
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() } |