From 3172dbf701f65cdfbdacd5acdd184b8de33c0928 Mon Sep 17 00:00:00 2001 From: chriseth Date: Fri, 24 Apr 2015 17:35:16 +0200 Subject: [PATCH 1/3] Move assembly related files to libevmasm and Params.h/.cpp to libevmcore. --- libsolidity/Assembly.cpp | 6 +++--- libsolidity/SolidityOptimizer.cpp | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/libsolidity/Assembly.cpp b/libsolidity/Assembly.cpp index 8dcee7fb5..ccc4bf811 100644 --- a/libsolidity/Assembly.cpp +++ b/libsolidity/Assembly.cpp @@ -17,20 +17,20 @@ /** * @author Lefteris Karapetsas * @date 2015 - * Unit tests for Assembly Items from evmcore/Assembly.h + * Unit tests for Assembly Items from evmasm/Assembly.h */ #include #include #include #include -#include +#include +#include #include #include #include #include #include -#include using namespace std; using namespace dev::eth; diff --git a/libsolidity/SolidityOptimizer.cpp b/libsolidity/SolidityOptimizer.cpp index ceb9c68d9..9cdaa5886 100644 --- a/libsolidity/SolidityOptimizer.cpp +++ b/libsolidity/SolidityOptimizer.cpp @@ -26,9 +26,9 @@ #include #include #include -#include -#include -#include +#include +#include +#include using namespace std; using namespace dev::eth; From 335c67a4e4a8352f5158c55b6ddd805e7045547b Mon Sep 17 00:00:00 2001 From: chriseth Date: Mon, 4 May 2015 10:16:10 +0200 Subject: [PATCH 2/3] Fix for broken continue in for loop. Fixes #1789. --- libsolidity/SolidityEndToEndTest.cpp | 46 ++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/libsolidity/SolidityEndToEndTest.cpp b/libsolidity/SolidityEndToEndTest.cpp index 24e5f7b4e..f168ad454 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" From dfd10d7dcc863c2ee6bb49b46208bac737af8fb9 Mon Sep 17 00:00:00 2001 From: Vlad Gluhovsky Date: Tue, 5 May 2015 13:11:32 +0200 Subject: [PATCH 3/3] libp2p test test for requirePeer function