aboutsummaryrefslogtreecommitdiffstats
path: root/test/libsolidity/SolidityEndToEndTest.cpp
diff options
context:
space:
mode:
authorchriseth <chris@ethereum.org>2017-05-30 02:32:47 +0800
committerchriseth <chris@ethereum.org>2017-06-08 21:52:45 +0800
commit64ddb176bb71498f3a129e0cc549797f4138ec1f (patch)
treef585c3ebc16d7feaeef87b3563dbb4f6656a8450 /test/libsolidity/SolidityEndToEndTest.cpp
parent97cc968a133247e729ed1d189d35ef2b7b53b3d4 (diff)
downloaddexon-solidity-64ddb176bb71498f3a129e0cc549797f4138ec1f.tar.gz
dexon-solidity-64ddb176bb71498f3a129e0cc549797f4138ec1f.tar.zst
dexon-solidity-64ddb176bb71498f3a129e0cc549797f4138ec1f.zip
Test for accessing outer inline assembly scope.
Diffstat (limited to 'test/libsolidity/SolidityEndToEndTest.cpp')
-rw-r--r--test/libsolidity/SolidityEndToEndTest.cpp27
1 files changed, 27 insertions, 0 deletions
diff --git a/test/libsolidity/SolidityEndToEndTest.cpp b/test/libsolidity/SolidityEndToEndTest.cpp
index bb8ec112..212c5111 100644
--- a/test/libsolidity/SolidityEndToEndTest.cpp
+++ b/test/libsolidity/SolidityEndToEndTest.cpp
@@ -7462,6 +7462,33 @@ BOOST_AUTO_TEST_CASE(inline_assembly_storage_access)
BOOST_CHECK(callContractFunction("z()") == encodeArgs(u256(7)));
}
+BOOST_AUTO_TEST_CASE(inline_assembly_storage_access_inside_function)
+{
+ char const* sourceCode = R"(
+ contract C {
+ uint16 x;
+ uint16 public y;
+ uint public z;
+ function f() returns (bool) {
+ uint off1;
+ uint off2;
+ assembly {
+ function f() -> o1 {
+ sstore(z_slot, 7)
+ o1 := y_offset
+ }
+ off2 := f()
+ }
+ assert(off2 == 2);
+ return true;
+ }
+ }
+ )";
+ compileAndRun(sourceCode, 0, "C");
+ BOOST_CHECK(callContractFunction("f()") == encodeArgs(true));
+ BOOST_CHECK(callContractFunction("z()") == encodeArgs(u256(7)));
+}
+
BOOST_AUTO_TEST_CASE(inline_assembly_storage_access_via_pointer)
{
char const* sourceCode = R"(