Add a missing tests for yul inliner optimization

When the statement has two return values, the function is not inlinable.

When the function has one statement but it is not an assignment to the
return variable, the function is not inlinable.

l
This commit is contained in:
Leo Arias 2018-09-16 05:25:35 +00:00
parent 5f4a2d2cad
commit aae385031f

View File

@ -116,6 +116,9 @@ BOOST_AUTO_TEST_CASE(negative)
BOOST_CHECK_EQUAL(inlinableFunctions("{ function f() -> x:u256 { x := f() } }"), "");
BOOST_CHECK_EQUAL(inlinableFunctions("{ function f() -> x:u256 { x := x } }"), "");
BOOST_CHECK_EQUAL(inlinableFunctions("{ function f() -> x:u256, y:u256 { x := 2:u256 } }"), "");
BOOST_CHECK_EQUAL(inlinableFunctions(
"{ function g() -> x:u256, y:u256 {} function f(y:u256) -> x:u256 { x,y := g() } }"), "");
BOOST_CHECK_EQUAL(inlinableFunctions("{ function f(y:u256) -> x:u256 { y := 2:u256 } }"), "");
}