diff options
author | chriseth <chris@ethereum.org> | 2016-11-01 02:21:04 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-11-01 02:21:04 +0800 |
commit | 4633f3def897db0f91237f98cf46e5d84fb05e61 (patch) | |
tree | 2dcc45c6ff2c95dc8871469aaa8e71d39807c8d7 /test/libsolidity | |
parent | 2353da71c77dd235b35d16e7e024fa62408df610 (diff) | |
parent | 979d18f19c711093cdc7f4112a76bf2135c97119 (diff) | |
download | dexon-solidity-4633f3def897db0f91237f98cf46e5d84fb05e61.tar.gz dexon-solidity-4633f3def897db0f91237f98cf46e5d84fb05e61.tar.zst dexon-solidity-4633f3def897db0f91237f98cf46e5d84fb05e61.zip |
Merge pull request #1308 from ethereum/develop
Merge for version 0.4.4
Diffstat (limited to 'test/libsolidity')
-rw-r--r-- | test/libsolidity/SolidityEndToEndTest.cpp | 20 | ||||
-rw-r--r-- | test/libsolidity/SolidityNameAndTypeResolution.cpp | 16 |
2 files changed, 36 insertions, 0 deletions
diff --git a/test/libsolidity/SolidityEndToEndTest.cpp b/test/libsolidity/SolidityEndToEndTest.cpp index 8ef9a45b..8600443d 100644 --- a/test/libsolidity/SolidityEndToEndTest.cpp +++ b/test/libsolidity/SolidityEndToEndTest.cpp @@ -7533,6 +7533,26 @@ BOOST_AUTO_TEST_CASE(inline_assembly_in_modifiers) BOOST_CHECK(callContractFunction("f()") == encodeArgs(true)); } +BOOST_AUTO_TEST_CASE(packed_storage_overflow) +{ + char const* sourceCode = R"( + contract C { + uint16 x = 0x1234; + uint16 a = 0xffff; + uint16 b; + function f() returns (uint, uint, uint, uint) { + a++; + uint c = b; + delete b; + a -= 2; + return (x, c, b, a); + } + } + )"; + compileAndRun(sourceCode, 0, "C"); + BOOST_CHECK(callContractFunction("f()") == encodeArgs(u256(0x1234), u256(0), u256(0), u256(0xfffe))); +} + BOOST_AUTO_TEST_SUITE_END() } diff --git a/test/libsolidity/SolidityNameAndTypeResolution.cpp b/test/libsolidity/SolidityNameAndTypeResolution.cpp index 9fe91cca..640cc108 100644 --- a/test/libsolidity/SolidityNameAndTypeResolution.cpp +++ b/test/libsolidity/SolidityNameAndTypeResolution.cpp @@ -2098,6 +2098,22 @@ BOOST_AUTO_TEST_CASE(integer_boolean_operators) BOOST_CHECK(expectError(sourceCode3) == Error::Type::TypeError); } +BOOST_AUTO_TEST_CASE(exp_signed_variable) +{ + char const* sourceCode1 = R"( + contract test { function() { uint x = 3; int y = -4; x ** y; } } + )"; + BOOST_CHECK(expectError(sourceCode1) == Error::Type::TypeError); + char const* sourceCode2 = R"( + contract test { function() { uint x = 3; int y = -4; y ** x; } } + )"; + BOOST_CHECK(expectError(sourceCode2) == Error::Type::TypeError); + char const* sourceCode3 = R"( + contract test { function() { int x = -3; int y = -4; x ** y; } } + )"; + BOOST_CHECK(expectError(sourceCode3) == Error::Type::TypeError); +} + BOOST_AUTO_TEST_CASE(reference_compare_operators) { char const* sourceCode1 = R"( |