diff options
author | Yoichi Hirai <i@yoichihirai.com> | 2016-11-09 18:50:09 +0800 |
---|---|---|
committer | Yoichi Hirai <i@yoichihirai.com> | 2016-11-12 00:48:03 +0800 |
commit | 457daecba1f7e267cf7578b702945bb6532aa2af (patch) | |
tree | fe0343630efebc9b10bc24283b4687301a6da24a /test/libsolidity/SolidityEndToEndTest.cpp | |
parent | 08a889a90863ff11cca9cb0b8c141ff5ca11a42e (diff) | |
download | dexon-solidity-457daecba1f7e267cf7578b702945bb6532aa2af.tar.gz dexon-solidity-457daecba1f7e267cf7578b702945bb6532aa2af.tar.zst dexon-solidity-457daecba1f7e267cf7578b702945bb6532aa2af.zip |
test: add a test converting -1 as a literal into an enum
This shows #1334 fixes #1344
Diffstat (limited to 'test/libsolidity/SolidityEndToEndTest.cpp')
-rw-r--r-- | test/libsolidity/SolidityEndToEndTest.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/test/libsolidity/SolidityEndToEndTest.cpp b/test/libsolidity/SolidityEndToEndTest.cpp index 09c3b681..5582e4a1 100644 --- a/test/libsolidity/SolidityEndToEndTest.cpp +++ b/test/libsolidity/SolidityEndToEndTest.cpp @@ -3360,6 +3360,11 @@ BOOST_AUTO_TEST_CASE(enum_explicit_overflow) choice = ActionChoices(x); d = uint256(choice); } + function getChoiceFromNegativeLiteral() returns (uint d) + { + choice = ActionChoices(-1); + d = uint256(choice); + } ActionChoices choice; } )"; @@ -3367,6 +3372,7 @@ BOOST_AUTO_TEST_CASE(enum_explicit_overflow) // These should throw BOOST_CHECK(callContractFunction("getChoiceExp(uint256)", 3) == encodeArgs()); BOOST_CHECK(callContractFunction("getChoiceFromSigned(int256)", -1) == encodeArgs()); + BOOST_CHECK(callContractFunction("getChoiceFromNegativeLiteral()") == encodeArgs()); // These should work BOOST_CHECK(callContractFunction("getChoiceExp(uint256)", 2) == encodeArgs(2)); BOOST_CHECK(callContractFunction("getChoiceExp(uint256)", 0) == encodeArgs(0)); |