Replace stray solidity pragma with progamatically inserting it in SolidityOptimizer test

This commit is contained in:
Alex Beregszaszi 2018-07-28 12:55:50 +01:00
parent db6c1c8ddd
commit 7fa2d0c84e

View File

@ -74,9 +74,9 @@ public:
unsigned const _optimizeRuns = 200 unsigned const _optimizeRuns = 200
) )
{ {
m_nonOptimizedBytecode = compileAndRunWithOptimizer(_sourceCode, _value, _contractName, false, _optimizeRuns); m_nonOptimizedBytecode = compileAndRunWithOptimizer("pragma solidity >=0.0;\n" + _sourceCode, _value, _contractName, false, _optimizeRuns);
m_nonOptimizedContract = m_contractAddress; m_nonOptimizedContract = m_contractAddress;
m_optimizedBytecode = compileAndRunWithOptimizer(_sourceCode, _value, _contractName, true, _optimizeRuns); m_optimizedBytecode = compileAndRunWithOptimizer("pragma solidity >=0.0;\n" + _sourceCode, _value, _contractName, true, _optimizeRuns);
size_t nonOptimizedSize = numInstructions(m_nonOptimizedBytecode); size_t nonOptimizedSize = numInstructions(m_nonOptimizedBytecode);
size_t optimizedSize = numInstructions(m_optimizedBytecode); size_t optimizedSize = numInstructions(m_optimizedBytecode);
BOOST_CHECK_MESSAGE( BOOST_CHECK_MESSAGE(
@ -441,8 +441,6 @@ BOOST_AUTO_TEST_CASE(constant_optimization_early_exit)
// This tests that the constant optimizer does not try to find the best representation // This tests that the constant optimizer does not try to find the best representation
// indefinitely but instead stops after some number of iterations. // indefinitely but instead stops after some number of iterations.
char const* sourceCode = R"( char const* sourceCode = R"(
pragma solidity ^0.4.0;
contract HexEncoding { contract HexEncoding {
function hexEncodeTest(address addr) public returns (bytes32 ret) { function hexEncodeTest(address addr) public returns (bytes32 ret) {
uint x = uint(addr) / 2**32; uint x = uint(addr) / 2**32;