mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Use the TestCase settings mechanism for object compiler tests.
This commit is contained in:
parent
547173533c
commit
ba8ad1a1d9
@ -46,14 +46,12 @@ ObjectCompilerTest::ObjectCompilerTest(string const& _filename)
|
||||
BOOST_THROW_EXCEPTION(runtime_error("Cannot open test case: \"" + _filename + "\"."));
|
||||
file.exceptions(ios::badbit);
|
||||
|
||||
string line;
|
||||
while (getline(file, line))
|
||||
m_source = parseSourceAndSettings(file);
|
||||
if (m_settings.count("optimize"))
|
||||
{
|
||||
if (boost::algorithm::starts_with(line, "// ----"))
|
||||
break;
|
||||
if (m_source.empty() && boost::algorithm::starts_with(line, "// optimize"))
|
||||
m_optimize = true;
|
||||
m_source += line + "\n";
|
||||
m_optimize = true;
|
||||
m_validatedSettings["optimize"] = "true";
|
||||
m_settings.erase("optimize");
|
||||
}
|
||||
m_expectation = parseSimpleExpectations(file);
|
||||
}
|
||||
|
@ -1,4 +1,3 @@
|
||||
// optimize
|
||||
object "a" {
|
||||
code {
|
||||
let x := calldataload(0)
|
||||
@ -15,24 +14,26 @@ object "a" {
|
||||
}
|
||||
}
|
||||
}
|
||||
// ====
|
||||
// optimize: true
|
||||
// ----
|
||||
// Assembly:
|
||||
// /* "source":60:61 */
|
||||
// /* "source":48:49 */
|
||||
// 0x00
|
||||
// 0x00
|
||||
// /* "source":47:62 */
|
||||
// /* "source":35:50 */
|
||||
// calldataload
|
||||
// /* "source":119:139 */
|
||||
// /* "source":107:127 */
|
||||
// sstore
|
||||
// stop
|
||||
//
|
||||
// sub_0: assembly {
|
||||
// /* "source":200:201 */
|
||||
// /* "source":188:189 */
|
||||
// 0x00
|
||||
// 0x00
|
||||
// /* "source":187:202 */
|
||||
// /* "source":175:190 */
|
||||
// calldataload
|
||||
// /* "source":265:285 */
|
||||
// /* "source":253:273 */
|
||||
// sstore
|
||||
// }
|
||||
// Bytecode: 600060003555fe
|
||||
|
@ -1,18 +1,19 @@
|
||||
// optimize
|
||||
{
|
||||
let x := calldataload(0)
|
||||
let y := calldataload(0)
|
||||
let z := sub(y, x)
|
||||
sstore(add(x, 0), z)
|
||||
}
|
||||
// ====
|
||||
// optimize: true
|
||||
// ----
|
||||
// Assembly:
|
||||
// /* "source":38:39 */
|
||||
// /* "source":26:27 */
|
||||
// 0x00
|
||||
// 0x00
|
||||
// /* "source":25:40 */
|
||||
// /* "source":13:28 */
|
||||
// calldataload
|
||||
// /* "source":91:111 */
|
||||
// /* "source":79:99 */
|
||||
// sstore
|
||||
// Bytecode: 600060003555
|
||||
// Opcodes: PUSH1 0x0 PUSH1 0x0 CALLDATALOAD SSTORE
|
||||
|
Loading…
Reference in New Issue
Block a user