diff options
author | chriseth <chris@ethereum.org> | 2018-09-04 22:51:17 +0800 |
---|---|---|
committer | chriseth <chris@ethereum.org> | 2018-09-10 20:27:57 +0800 |
commit | f190caf538f25baa200195baf6f7444927faf926 (patch) | |
tree | 32951208fa58c7a1c038de0c4e7808d3bfc77c5a | |
parent | b9164eaba2a192428a27bac045c529c438599af7 (diff) | |
download | dexon-solidity-f190caf538f25baa200195baf6f7444927faf926.tar dexon-solidity-f190caf538f25baa200195baf6f7444927faf926.tar.gz dexon-solidity-f190caf538f25baa200195baf6f7444927faf926.tar.bz2 dexon-solidity-f190caf538f25baa200195baf6f7444927faf926.tar.lz dexon-solidity-f190caf538f25baa200195baf6f7444927faf926.tar.xz dexon-solidity-f190caf538f25baa200195baf6f7444927faf926.tar.zst dexon-solidity-f190caf538f25baa200195baf6f7444927faf926.zip |
Tests.
-rw-r--r-- | test/libsolidity/SolidityEndToEndTest.cpp | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/test/libsolidity/SolidityEndToEndTest.cpp b/test/libsolidity/SolidityEndToEndTest.cpp index a4b59761..f2cc78bf 100644 --- a/test/libsolidity/SolidityEndToEndTest.cpp +++ b/test/libsolidity/SolidityEndToEndTest.cpp @@ -10743,6 +10743,46 @@ BOOST_AUTO_TEST_CASE(shift_bytes_cleanup) ABI_CHECK(callContractFunction("right(uint8)", 8 * 8), encodeArgs(string(8, 0) + "123456789012")); } +BOOST_AUTO_TEST_CASE(exp_cleanup) +{ + char const* sourceCode = R"( + contract C { + function f() public pure returns (uint8 x) { + uint8 y = uint8(2) ** uint8(8); + return 0 ** y; + } + } + )"; + compileAndRun(sourceCode, 0, "C"); + ABI_CHECK(callContractFunction("f()"), encodeArgs(u256(0x1))); +} + +BOOST_AUTO_TEST_CASE(exp_cleanup_direct) +{ + char const* sourceCode = R"( + contract C { + function f() public pure returns (uint8 x) { + return uint8(0) ** uint8(uint8(2) ** uint8(8)); + } + } + )"; + compileAndRun(sourceCode, 0, "C"); + ABI_CHECK(callContractFunction("f()"), encodeArgs(u256(0x1))); +} + +BOOST_AUTO_TEST_CASE(exp_cleanup_nonzero_base) +{ + char const* sourceCode = R"( + contract C { + function f() public pure returns (uint8 x) { + return uint8(0x166) ** uint8(uint8(2) ** uint8(8)); + } + } + )"; + compileAndRun(sourceCode, 0, "C"); + ABI_CHECK(callContractFunction("f()"), encodeArgs(u256(0x1))); +} + BOOST_AUTO_TEST_CASE(cleanup_in_compound_assign) { char const* sourceCode = R"( |