aboutsummaryrefslogtreecommitdiffstats
path: root/test/libsolidity/SolidityEndToEndTest.cpp
diff options
context:
space:
mode:
authorchriseth <c@ethdev.com>2016-05-08 22:24:47 +0800
committerchriseth <c@ethdev.com>2016-05-12 18:30:48 +0800
commit67ca3bb4b9b43faadb1d6a07f868c94bae146c1e (patch)
tree9ca400548764845c9d9977ed0ac3dc6ac4ffde9c /test/libsolidity/SolidityEndToEndTest.cpp
parent1ab0f25dffe19f2cc9e1a0e2fa03a1091679f5a0 (diff)
downloaddexon-solidity-67ca3bb4b9b43faadb1d6a07f868c94bae146c1e.tar.gz
dexon-solidity-67ca3bb4b9b43faadb1d6a07f868c94bae146c1e.tar.zst
dexon-solidity-67ca3bb4b9b43faadb1d6a07f868c94bae146c1e.zip
Allow access to functions in inline assembly.
Diffstat (limited to 'test/libsolidity/SolidityEndToEndTest.cpp')
-rw-r--r--test/libsolidity/SolidityEndToEndTest.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/test/libsolidity/SolidityEndToEndTest.cpp b/test/libsolidity/SolidityEndToEndTest.cpp
index de428f96..a220fe09 100644
--- a/test/libsolidity/SolidityEndToEndTest.cpp
+++ b/test/libsolidity/SolidityEndToEndTest.cpp
@@ -6595,6 +6595,25 @@ BOOST_AUTO_TEST_CASE(inline_assembly_jumps)
BOOST_CHECK(callContractFunction("f()", u256(7)) == encodeArgs(u256(34)));
}
+BOOST_AUTO_TEST_CASE(inline_assembly_function_access)
+{
+ char const* sourceCode = R"(
+ contract C {
+ uint public x;
+ function g(uint y) { x = 2 * y; assembly { stop } }
+ function f(uint _x) {
+ assembly {
+ _x
+ jump(g)
+ }
+ }
+ }
+ )";
+ compileAndRun(sourceCode, 0, "C");
+ BOOST_CHECK(callContractFunction("f(uint256)", u256(5)) == encodeArgs());
+ BOOST_CHECK(callContractFunction("x()") == encodeArgs(u256(10)));
+}
+
BOOST_AUTO_TEST_CASE(index_access_with_type_conversion)
{
// Test for a bug where higher order bits cleanup was not done for array index access.