diff options
author | Alex Beregszaszi <alex@rtfs.hu> | 2017-06-23 22:50:29 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-06-23 22:50:29 +0800 |
commit | 367389472bf9580fabede5e50d2e3264072fce24 (patch) | |
tree | 454960a62e6291defb7bffd528390786c16d1b9f /test | |
parent | 1f7697eee318445e770d4e634477c38685af5110 (diff) | |
parent | b46bb70b969aaa2d38ee84b3732999ec141dbd85 (diff) | |
download | dexon-solidity-367389472bf9580fabede5e50d2e3264072fce24.tar.gz dexon-solidity-367389472bf9580fabede5e50d2e3264072fce24.tar.zst dexon-solidity-367389472bf9580fabede5e50d2e3264072fce24.zip |
Merge pull request #2439 from ethereum/lll-vars
LLL: fix variable (set/get/ref) handling
Diffstat (limited to 'test')
-rw-r--r-- | test/liblll/EndToEndTest.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/test/liblll/EndToEndTest.cpp b/test/liblll/EndToEndTest.cpp index 02d024a4..3037b14b 100644 --- a/test/liblll/EndToEndTest.cpp +++ b/test/liblll/EndToEndTest.cpp @@ -57,6 +57,26 @@ BOOST_AUTO_TEST_CASE(panic) BOOST_REQUIRE(m_output.empty()); } +BOOST_AUTO_TEST_CASE(variables) +{ + char const* sourceCode = R"( + (returnlll + (seq + (set 'x 1) + (set 'y 2) + ;; this should equal to 3 + (set 'z (add (get 'x) (get 'y))) + ;; overwriting it here + (set 'y 4) + ;; each variable has a 32 byte slot, starting from memory location 0x80 + ;; variable addresses can also be retrieved by x or (ref 'x) + (set 'k (add (add (ref 'x) (ref 'y)) z)) + (return (add (add (get 'x) (add (get 'y) (get 'z))) (get 'k))))) + )"; + compileAndRun(sourceCode); + BOOST_CHECK(callFallback() == encodeArgs(u256(488))); +} + BOOST_AUTO_TEST_CASE(when) { char const* sourceCode = R"( |