diff options
author | CJentzsch <jentzsch.software@gmail.com> | 2015-05-07 17:44:23 +0800 |
---|---|---|
committer | CJentzsch <jentzsch.software@gmail.com> | 2015-05-07 17:44:23 +0800 |
commit | 612ee398b7dae5f387f94fe169de4301929d5ac4 (patch) | |
tree | f5f22f1068cc2de0386c087d90593ad263c84992 /libsolidity/SolidityEndToEndTest.cpp | |
parent | 75982d444f52e864e56daf6054c2f13835b3a961 (diff) | |
parent | e66e225827624ccaaf88f4897715e6e5032849e0 (diff) | |
download | dexon-solidity-612ee398b7dae5f387f94fe169de4301929d5ac4.tar dexon-solidity-612ee398b7dae5f387f94fe169de4301929d5ac4.tar.gz dexon-solidity-612ee398b7dae5f387f94fe169de4301929d5ac4.tar.bz2 dexon-solidity-612ee398b7dae5f387f94fe169de4301929d5ac4.tar.lz dexon-solidity-612ee398b7dae5f387f94fe169de4301929d5ac4.tar.xz dexon-solidity-612ee398b7dae5f387f94fe169de4301929d5ac4.tar.zst dexon-solidity-612ee398b7dae5f387f94fe169de4301929d5ac4.zip |
Merge remote-tracking branch 'upstream/develop' into walletTests
Diffstat (limited to 'libsolidity/SolidityEndToEndTest.cpp')
-rw-r--r-- | libsolidity/SolidityEndToEndTest.cpp | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/libsolidity/SolidityEndToEndTest.cpp b/libsolidity/SolidityEndToEndTest.cpp index 24e5f7b4..f168ad45 100644 --- a/libsolidity/SolidityEndToEndTest.cpp +++ b/libsolidity/SolidityEndToEndTest.cpp @@ -300,6 +300,52 @@ BOOST_AUTO_TEST_CASE(for_loop_simple_init_expr) testSolidityAgainstCppOnRange("f(uint256)", for_loop_simple_init_expr_cpp, 0, 5); } +BOOST_AUTO_TEST_CASE(for_loop_break_continue) +{ + char const* sourceCode = R"( + contract test { + function f(uint n) returns (uint r) + { + uint i = 1; + uint k = 0; + for (i *= 5; k < n; i *= 7) + { + k++; + i += 4; + if (n % 3 == 0) + break; + i += 9; + if (n % 2 == 0) + continue; + i += 19; + } + return i; + } + } + )"; + compileAndRun(sourceCode); + + auto breakContinue = [](u256 const& n) -> u256 + { + u256 i = 1; + u256 k = 0; + for (i *= 5; k < n; i *= 7) + { + k++; + i += 4; + if (n % 3 == 0) + break; + i += 9; + if (n % 2 == 0) + continue; + i += 19; + } + return i; + }; + + testSolidityAgainstCppOnRange("f(uint256)", breakContinue, 0, 10); +} + BOOST_AUTO_TEST_CASE(calling_other_functions) { char const* sourceCode = "contract collatz {\n" |