mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Fix optimizer tests.
This commit is contained in:
parent
8c5a56d864
commit
8b68d476c2
@ -79,6 +79,8 @@ public:
|
|||||||
bytes nonOptimizedOutput = callContractFunction(_sig, _arguments...);
|
bytes nonOptimizedOutput = callContractFunction(_sig, _arguments...);
|
||||||
m_contractAddress = m_optimizedContract;
|
m_contractAddress = m_optimizedContract;
|
||||||
bytes optimizedOutput = callContractFunction(_sig, _arguments...);
|
bytes optimizedOutput = callContractFunction(_sig, _arguments...);
|
||||||
|
BOOST_CHECK_MESSAGE(!optimizedOutput.empty(), "No optimized output for " + _sig);
|
||||||
|
BOOST_CHECK_MESSAGE(!nonOptimizedOutput.empty(), "No un-optimized output for " + _sig);
|
||||||
BOOST_CHECK_MESSAGE(nonOptimizedOutput == optimizedOutput, "Computed values do not match."
|
BOOST_CHECK_MESSAGE(nonOptimizedOutput == optimizedOutput, "Computed values do not match."
|
||||||
"\nNon-Optimized: " + toHex(nonOptimizedOutput) +
|
"\nNon-Optimized: " + toHex(nonOptimizedOutput) +
|
||||||
"\nOptimized: " + toHex(optimizedOutput));
|
"\nOptimized: " + toHex(optimizedOutput));
|
||||||
@ -176,7 +178,7 @@ BOOST_AUTO_TEST_CASE(identities)
|
|||||||
}
|
}
|
||||||
})";
|
})";
|
||||||
compileBothVersions(sourceCode);
|
compileBothVersions(sourceCode);
|
||||||
compareVersions("f(uint256)", u256(0x12334664));
|
compareVersions("f(int256)", u256(0x12334664));
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOST_AUTO_TEST_CASE(unused_expressions)
|
BOOST_AUTO_TEST_CASE(unused_expressions)
|
||||||
@ -230,6 +232,7 @@ BOOST_AUTO_TEST_CASE(array_copy)
|
|||||||
bytes2[] data1;
|
bytes2[] data1;
|
||||||
bytes5[] data2;
|
bytes5[] data2;
|
||||||
function f(uint x) returns (uint l, uint y) {
|
function f(uint x) returns (uint l, uint y) {
|
||||||
|
data1.length = msg.data.length;
|
||||||
for (uint i = 0; i < msg.data.length; ++i)
|
for (uint i = 0; i < msg.data.length; ++i)
|
||||||
data1[i] = msg.data[i];
|
data1[i] = msg.data[i];
|
||||||
data2 = data1;
|
data2 = data1;
|
||||||
@ -241,7 +244,7 @@ BOOST_AUTO_TEST_CASE(array_copy)
|
|||||||
compileBothVersions(sourceCode);
|
compileBothVersions(sourceCode);
|
||||||
compareVersions("f(uint256)", 0);
|
compareVersions("f(uint256)", 0);
|
||||||
compareVersions("f(uint256)", 10);
|
compareVersions("f(uint256)", 10);
|
||||||
compareVersions("f(uint256)", 36);
|
compareVersions("f(uint256)", 35);
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOST_AUTO_TEST_CASE(function_calls)
|
BOOST_AUTO_TEST_CASE(function_calls)
|
||||||
@ -346,7 +349,7 @@ BOOST_AUTO_TEST_CASE(store_tags_as_unions)
|
|||||||
}
|
}
|
||||||
)";
|
)";
|
||||||
compileBothVersions(sourceCode);
|
compileBothVersions(sourceCode);
|
||||||
compareVersions("f()", 7, "abc");
|
compareVersions("f(uint256,bytes32)", 7, "abc");
|
||||||
|
|
||||||
m_optimize = true;
|
m_optimize = true;
|
||||||
bytes optimizedBytecode = compileAndRun(sourceCode, 0, "test");
|
bytes optimizedBytecode = compileAndRun(sourceCode, 0, "test");
|
||||||
|
Loading…
Reference in New Issue
Block a user