aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYoichi Hirai <i@yoichihirai.com>2016-11-09 18:40:52 +0800
committerYoichi Hirai <i@yoichihirai.com>2016-11-12 00:48:03 +0800
commit08a889a90863ff11cca9cb0b8c141ff5ca11a42e (patch)
treee43740345261acd8d8e6b672f96d9c16feebb80b
parent1af3c4f754be05c82a0aee4d309a3e681387eaed (diff)
downloaddexon-solidity-08a889a90863ff11cca9cb0b8c141ff5ca11a42e.tar.gz
dexon-solidity-08a889a90863ff11cca9cb0b8c141ff5ca11a42e.tar.zst
dexon-solidity-08a889a90863ff11cca9cb0b8c141ff5ca11a42e.zip
test: add a test case for #1343
The test witnesses that #1334 fixes #1343.
-rw-r--r--test/libsolidity/SolidityEndToEndTest.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/test/libsolidity/SolidityEndToEndTest.cpp b/test/libsolidity/SolidityEndToEndTest.cpp
index 90547ad9..09c3b681 100644
--- a/test/libsolidity/SolidityEndToEndTest.cpp
+++ b/test/libsolidity/SolidityEndToEndTest.cpp
@@ -3355,12 +3355,18 @@ BOOST_AUTO_TEST_CASE(enum_explicit_overflow)
choice = ActionChoices(x);
d = uint256(choice);
}
+ function getChoiceFromSigned(int x) returns (uint d)
+ {
+ choice = ActionChoices(x);
+ d = uint256(choice);
+ }
ActionChoices choice;
}
)";
compileAndRun(sourceCode);
// These should throw
BOOST_CHECK(callContractFunction("getChoiceExp(uint256)", 3) == encodeArgs());
+ BOOST_CHECK(callContractFunction("getChoiceFromSigned(int256)", -1) == encodeArgs());
// These should work
BOOST_CHECK(callContractFunction("getChoiceExp(uint256)", 2) == encodeArgs(2));
BOOST_CHECK(callContractFunction("getChoiceExp(uint256)", 0) == encodeArgs(0));