diff options
author | chriseth <c@ethdev.com> | 2015-05-08 18:40:11 +0800 |
---|---|---|
committer | chriseth <c@ethdev.com> | 2015-05-11 18:56:40 +0800 |
commit | cc6647e671044d442a57c92119fabcc902c1a189 (patch) | |
tree | acc61a9b34b103181f3bb24f579974cb0d1d5eed /libsolidity | |
parent | 2cc62fbbfba89afaa2d83728ebb5b5c4488dd110 (diff) | |
download | dexon-solidity-cc6647e671044d442a57c92119fabcc902c1a189.tar dexon-solidity-cc6647e671044d442a57c92119fabcc902c1a189.tar.gz dexon-solidity-cc6647e671044d442a57c92119fabcc902c1a189.tar.bz2 dexon-solidity-cc6647e671044d442a57c92119fabcc902c1a189.tar.lz dexon-solidity-cc6647e671044d442a57c92119fabcc902c1a189.tar.xz dexon-solidity-cc6647e671044d442a57c92119fabcc902c1a189.tar.zst dexon-solidity-cc6647e671044d442a57c92119fabcc902c1a189.zip |
Tests.
Diffstat (limited to 'libsolidity')
-rw-r--r-- | libsolidity/SolidityOptimizer.cpp | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/libsolidity/SolidityOptimizer.cpp b/libsolidity/SolidityOptimizer.cpp index 3cb6a536..4986b146 100644 --- a/libsolidity/SolidityOptimizer.cpp +++ b/libsolidity/SolidityOptimizer.cpp @@ -251,6 +251,27 @@ BOOST_AUTO_TEST_CASE(function_calls) compareVersions("f(uint256)", 36); } +BOOST_AUTO_TEST_CASE(storage_write_in_loops) +{ + char const* sourceCode = R"( + contract test { + uint d; + function f(uint a) returns (uint r) { + var x = d; + for (uint i = 1; i < a * a; i++) { + r = d; + d = i; + } + + } + } + )"; + compileBothVersions(sourceCode); + compareVersions("f(uint256)", 0); + compareVersions("f(uint256)", 10); + compareVersions("f(uint256)", 36); +} + BOOST_AUTO_TEST_CASE(cse_intermediate_swap) { eth::KnownState state; |