aboutsummaryrefslogtreecommitdiffstats
path: root/test/libsolidity
diff options
context:
space:
mode:
authorchriseth <c@ethdev.com>2016-05-18 05:59:13 +0800
committerchriseth <c@ethdev.com>2016-05-18 05:59:13 +0800
commit775b757d0e2681901036fa34a67a3b5ceec24816 (patch)
tree47f4927e0a991492ea709a4e2523289082d950a4 /test/libsolidity
parent5bf059dc2a1f82a0bf2e8fb9ab06439d01bf29f7 (diff)
parente28604f0b021105b8e0863e485895f1009a77d37 (diff)
downloaddexon-solidity-775b757d0e2681901036fa34a67a3b5ceec24816.tar.gz
dexon-solidity-775b757d0e2681901036fa34a67a3b5ceec24816.tar.zst
dexon-solidity-775b757d0e2681901036fa34a67a3b5ceec24816.zip
Merge pull request #545 from chriseth/accessFunLabels
Allow access to functions in inline assembly.
Diffstat (limited to 'test/libsolidity')
-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 43bdc5a9..8c537346 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.