From af57c083f2aa144e765a7345f15713330b192e36 Mon Sep 17 00:00:00 2001 From: Alex Beregszaszi Date: Thu, 22 Jun 2017 00:43:01 +0100 Subject: LLL: fix the set keyword (create symbol if not present) --- test/liblll/EndToEndTest.cpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'test') 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"( -- cgit v1.2.3