diff options
author | chriseth <chris@ethereum.org> | 2018-02-02 01:02:10 +0800 |
---|---|---|
committer | chriseth <chris@ethereum.org> | 2018-02-07 05:51:30 +0800 |
commit | 5523296eaa68a591a331d9b75dc19cf11d1c538e (patch) | |
tree | 658443a1c32b42b56c06dca9d491f5c7e980a007 /test | |
parent | f7392cc6983a48ab0d482270912bd5de4042e577 (diff) | |
download | dexon-solidity-5523296eaa68a591a331d9b75dc19cf11d1c538e.tar dexon-solidity-5523296eaa68a591a331d9b75dc19cf11d1c538e.tar.gz dexon-solidity-5523296eaa68a591a331d9b75dc19cf11d1c538e.tar.bz2 dexon-solidity-5523296eaa68a591a331d9b75dc19cf11d1c538e.tar.lz dexon-solidity-5523296eaa68a591a331d9b75dc19cf11d1c538e.tar.xz dexon-solidity-5523296eaa68a591a331d9b75dc19cf11d1c538e.tar.zst dexon-solidity-5523296eaa68a591a331d9b75dc19cf11d1c538e.zip |
Also apply simplification rules that require multiple identical sub-expressions.
Diffstat (limited to 'test')
-rw-r--r-- | test/libjulia/Simplifier.cpp | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/test/libjulia/Simplifier.cpp b/test/libjulia/Simplifier.cpp index dc3a0485..b48d45c8 100644 --- a/test/libjulia/Simplifier.cpp +++ b/test/libjulia/Simplifier.cpp @@ -87,6 +87,30 @@ BOOST_AUTO_TEST_CASE(constant_propagation) ); } +BOOST_AUTO_TEST_CASE(identity_rules_simple) +{ + CHECK( + "{ let a := mload(0) let b := sub(a, a) }", + "{ let a := mload(0) let b := 0 }" + ); +} + +BOOST_AUTO_TEST_CASE(identity_rules_complex) +{ + CHECK( + "{ let a := sub(calldataload(0), calldataload(0)) }", + "{ let a := 0 }" + ); +} + +BOOST_AUTO_TEST_CASE(identity_rules_negative) +{ + CHECK( + "{ let a := sub(calldataload(1), calldataload(0)) }", + "{ let a := sub(calldataload(1), calldataload(0)) }" + ); +} + BOOST_AUTO_TEST_CASE(including_function_calls) { CHECK( |