aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorchriseth <chris@ethereum.org>2018-09-25 22:24:40 +0800
committerchriseth <chris@ethereum.org>2018-09-25 23:16:22 +0800
commitba62831143e5d4f8ebef6242f821e7a1b3dfc810 (patch)
treec1d77003ad4a7d4ff406361fb11043e1cc2b291c /test
parent1b8334e58bd75dae3cc113431e36f9af972f3b1d (diff)
downloaddexon-solidity-ba62831143e5d4f8ebef6242f821e7a1b3dfc810.tar.gz
dexon-solidity-ba62831143e5d4f8ebef6242f821e7a1b3dfc810.tar.zst
dexon-solidity-ba62831143e5d4f8ebef6242f821e7a1b3dfc810.zip
Tests for inlining inside condition.
Diffstat (limited to 'test')
-rw-r--r--test/libjulia/Inliner.cpp35
1 files changed, 35 insertions, 0 deletions
diff --git a/test/libjulia/Inliner.cpp b/test/libjulia/Inliner.cpp
index 43a7d757..0cffabb2 100644
--- a/test/libjulia/Inliner.cpp
+++ b/test/libjulia/Inliner.cpp
@@ -342,5 +342,40 @@ BOOST_AUTO_TEST_CASE(pop_result)
);
}
+BOOST_AUTO_TEST_CASE(inside_condition)
+{
+ // This tests that breaking the expresison inside the condition works properly.
+ BOOST_CHECK_EQUAL(
+ fullInline(R"({
+ if gt(f(mload(1)), mload(0)) {
+ sstore(0, 2)
+ }
+ function f(a) -> r {
+ a := mload(a)
+ r := add(a, calldatasize())
+ }
+ })", false),
+ format(R"({
+ {
+ let _1 := mload(0)
+ let f_a := mload(1)
+ let f_r
+ {
+ f_a := mload(f_a)
+ f_r := add(f_a, calldatasize())
+ }
+ if gt(f_r, _1)
+ {
+ sstore(0, 2)
+ }
+ }
+ function f(a) -> r
+ {
+ a := mload(a)
+ r := add(a, calldatasize())
+ }
+ })", false)
+ );
+}
BOOST_AUTO_TEST_SUITE_END()