aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorYoichi Hirai <i@yoichihirai.com>2016-12-13 23:35:42 +0800
committerYoichi Hirai <i@yoichihirai.com>2016-12-13 23:35:42 +0800
commit932e7887bde0ac84b86c257d321a48647b024e6d (patch)
tree5ea1a957712d1fb6fe964c9cc45eb91a9692725a /test
parentcc117399281361124714dfd0914fa92e6aec78ef (diff)
downloaddexon-solidity-932e7887bde0ac84b86c257d321a48647b024e6d.tar
dexon-solidity-932e7887bde0ac84b86c257d321a48647b024e6d.tar.gz
dexon-solidity-932e7887bde0ac84b86c257d321a48647b024e6d.tar.bz2
dexon-solidity-932e7887bde0ac84b86c257d321a48647b024e6d.tar.lz
dexon-solidity-932e7887bde0ac84b86c257d321a48647b024e6d.tar.xz
dexon-solidity-932e7887bde0ac84b86c257d321a48647b024e6d.tar.zst
dexon-solidity-932e7887bde0ac84b86c257d321a48647b024e6d.zip
test: add tests that tries different types on <<=
Diffstat (limited to 'test')
-rw-r--r--test/libsolidity/SolidityEndToEndTest.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/test/libsolidity/SolidityEndToEndTest.cpp b/test/libsolidity/SolidityEndToEndTest.cpp
index 9e2c41af..fd547f4e 100644
--- a/test/libsolidity/SolidityEndToEndTest.cpp
+++ b/test/libsolidity/SolidityEndToEndTest.cpp
@@ -8540,6 +8540,24 @@ BOOST_AUTO_TEST_CASE(shift_left_assignment)
BOOST_CHECK(callContractFunction("f(uint256,uint256)", u256(0x4266), u256(256)) == encodeArgs(u256(0)));
}
+BOOST_AUTO_TEST_CASE(shift_left_assignment_different_type)
+{
+ char const* sourceCode = R"(
+ contract C {
+ function f(uint a, uint8 b) returns (uint) {
+ a <<= b;
+ return a;
+ }
+ }
+ )";
+ compileAndRun(sourceCode, 0, "C");
+ BOOST_CHECK(callContractFunction("f(uint256,uint256)", u256(0x4266), u256(0)) == encodeArgs(u256(0x4266)));
+ BOOST_CHECK(callContractFunction("f(uint256,uint256)", u256(0x4266), u256(8)) == encodeArgs(u256(0x426600)));
+ BOOST_CHECK(callContractFunction("f(uint256,uint256)", u256(0x4266), u256(16)) == encodeArgs(u256(0x42660000)));
+ BOOST_CHECK(callContractFunction("f(uint256,uint256)", u256(0x4266), u256(17)) == encodeArgs(u256(0x84cc0000)));
+ BOOST_CHECK(callContractFunction("f(uint256,uint256)", u256(0x4266), u256(240)) == fromHex("4266000000000000000000000000000000000000000000000000000000000000"));
+}
+
BOOST_AUTO_TEST_CASE(shift_right)
{
char const* sourceCode = R"(