LLL: implement WITH keyword

This commit is contained in:
Alex Beregszaszi
2018-11-21 15:50:45 +00:00
parent dcfa5f4ea0
commit 7c051f1e32
2 changed files with 42 additions and 0 deletions
+13
View File
@@ -109,6 +109,19 @@ BOOST_AUTO_TEST_CASE(variables)
BOOST_CHECK(callFallback() == encodeArgs(u256(488)));
}
BOOST_AUTO_TEST_CASE(with)
{
char const* sourceCode = R"(
(returnlll
(seq
(set 'x 11)
(with 'y 22 { [0]:(+ (get 'x) (get 'y)) })
(return 0 32)))
)";
compileAndRun(sourceCode);
BOOST_CHECK(callFallback() == toBigEndian(u256(33)));
}
BOOST_AUTO_TEST_CASE(when)
{
char const* sourceCode = R"(