aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorchriseth <chris@ethereum.org>2018-08-09 18:08:55 +0800
committerGitHub <noreply@github.com>2018-08-09 18:08:55 +0800
commit63d071d6e0570a33e7dbbac1bfebc46e2d9f9188 (patch)
treea164ac9beda1dd56fdb232137542836d3d0b200f /test
parentfc99014fa2d27f298b1d6fa17e4db63be2768151 (diff)
parent1395bef7aeee20a5aaa0b5fd9ac0e64abaa5af11 (diff)
downloaddexon-solidity-63d071d6e0570a33e7dbbac1bfebc46e2d9f9188.tar
dexon-solidity-63d071d6e0570a33e7dbbac1bfebc46e2d9f9188.tar.gz
dexon-solidity-63d071d6e0570a33e7dbbac1bfebc46e2d9f9188.tar.bz2
dexon-solidity-63d071d6e0570a33e7dbbac1bfebc46e2d9f9188.tar.lz
dexon-solidity-63d071d6e0570a33e7dbbac1bfebc46e2d9f9188.tar.xz
dexon-solidity-63d071d6e0570a33e7dbbac1bfebc46e2d9f9188.tar.zst
dexon-solidity-63d071d6e0570a33e7dbbac1bfebc46e2d9f9188.zip
Merge pull request #4783 from elopio/test/function-call-syntactical-equality
tests: add yul simplifier not applied with function calls
Diffstat (limited to 'test')
-rw-r--r--test/libjulia/Simplifier.cpp28
1 files changed, 27 insertions, 1 deletions
diff --git a/test/libjulia/Simplifier.cpp b/test/libjulia/Simplifier.cpp
index e5b7e0d8..3cc95b7a 100644
--- a/test/libjulia/Simplifier.cpp
+++ b/test/libjulia/Simplifier.cpp
@@ -139,7 +139,7 @@ BOOST_AUTO_TEST_CASE(mod_and)
);
}
-BOOST_AUTO_TEST_CASE(not_applied)
+BOOST_AUTO_TEST_CASE(not_applied_removes_non_constant_and_not_movable)
{
CHECK(
// The first argument of div is not constant.
@@ -149,4 +149,30 @@ BOOST_AUTO_TEST_CASE(not_applied)
);
}
+BOOST_AUTO_TEST_CASE(not_applied_function_call_different_names)
+{
+ CHECK(
+ "{ function f1() -> a { } function f2() -> b {} let c := sub(f1(), f2()) }",
+ "{ function f1() -> a { } function f2() -> b {} let c := sub(f1(), f2()) }"
+ );
+}
+
+BOOST_AUTO_TEST_CASE(not_applied_function_call_different_arguments)
+{
+ CHECK(
+ "{ function f(a) -> b { } let c := sub(f(0), f(1)) }",
+ "{ function f(a) -> b { } let c := sub(f(0), f(1)) }"
+ );
+}
+
+BOOST_AUTO_TEST_CASE(not_applied_function_call_equality_not_movable)
+{
+ CHECK(
+ // Even if the functions pass the equality check, they are not movable.
+ "{ function f() -> a { } let b := sub(f(), f()) }",
+ "{ function f() -> a { } let b := sub(f(), f()) }"
+ );
+}
+
+
BOOST_AUTO_TEST_SUITE_END()