diff options
author | chriseth <c@ethdev.com> | 2015-11-17 17:57:18 +0800 |
---|---|---|
committer | chriseth <c@ethdev.com> | 2015-11-17 17:57:18 +0800 |
commit | 6411bf00266b4489cc4f928fdf7d486df73f84db (patch) | |
tree | 0ec9d18a9649e73f62563b8ba5fbaffe599e293a /test | |
parent | f63eca46fa057f9f994713272008676eef2f2c5d (diff) | |
parent | 8bd34ee2e927c36730b7bb70f97b6aad2b3c2ea3 (diff) | |
download | dexon-solidity-6411bf00266b4489cc4f928fdf7d486df73f84db.tar.gz dexon-solidity-6411bf00266b4489cc4f928fdf7d486df73f84db.tar.zst dexon-solidity-6411bf00266b4489cc4f928fdf7d486df73f84db.zip |
Merge pull request #214 from chriseth/fix_optimizerTest
Test fix: Do not increment iterator past end.
Diffstat (limited to 'test')
-rw-r--r-- | test/libsolidity/SolidityOptimizer.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/test/libsolidity/SolidityOptimizer.cpp b/test/libsolidity/SolidityOptimizer.cpp index 7db4f431..732f599f 100644 --- a/test/libsolidity/SolidityOptimizer.cpp +++ b/test/libsolidity/SolidityOptimizer.cpp @@ -1123,7 +1123,11 @@ BOOST_AUTO_TEST_CASE(computing_constants) bytes complicatedConstant = toBigEndian(u256("0x817416927846239487123469187231298734162934871263941234127518276")); unsigned occurrences = 0; for (auto iter = optimizedBytecode.cbegin(); iter < optimizedBytecode.cend(); ++occurrences) - iter = search(iter, optimizedBytecode.cend(), complicatedConstant.cbegin(), complicatedConstant.cend()) + 1; + { + iter = search(iter, optimizedBytecode.cend(), complicatedConstant.cbegin(), complicatedConstant.cend()); + if (iter < optimizedBytecode.cend()) + ++iter; + } BOOST_CHECK_EQUAL(2, occurrences); bytes constantWithZeros = toBigEndian(u256("0x77abc0000000000000000000000000000000000000000000000000000000001")); |