aboutsummaryrefslogtreecommitdiffstats
path: root/test/libsolidity
diff options
context:
space:
mode:
authorchriseth <chris@ethereum.org>2018-09-04 22:51:17 +0800
committerchriseth <chris@ethereum.org>2018-09-10 18:47:46 +0800
commit7118f5397485d42f38e66e98b163d7396e373a4e (patch)
treee8f2c14d194aaad33cccb11bc462101b8ca9ef82 /test/libsolidity
parent255eda2ea69cf1996b1d6e1289b47f394ae28712 (diff)
downloaddexon-solidity-7118f5397485d42f38e66e98b163d7396e373a4e.tar
dexon-solidity-7118f5397485d42f38e66e98b163d7396e373a4e.tar.gz
dexon-solidity-7118f5397485d42f38e66e98b163d7396e373a4e.tar.bz2
dexon-solidity-7118f5397485d42f38e66e98b163d7396e373a4e.tar.lz
dexon-solidity-7118f5397485d42f38e66e98b163d7396e373a4e.tar.xz
dexon-solidity-7118f5397485d42f38e66e98b163d7396e373a4e.tar.zst
dexon-solidity-7118f5397485d42f38e66e98b163d7396e373a4e.zip
Tests.
Diffstat (limited to 'test/libsolidity')
-rw-r--r--test/libsolidity/SolidityEndToEndTest.cpp40
1 files changed, 40 insertions, 0 deletions
diff --git a/test/libsolidity/SolidityEndToEndTest.cpp b/test/libsolidity/SolidityEndToEndTest.cpp
index 85582ece..6be9d95b 100644
--- a/test/libsolidity/SolidityEndToEndTest.cpp
+++ b/test/libsolidity/SolidityEndToEndTest.cpp
@@ -11870,6 +11870,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"(