diff options
author | chriseth <chris@ethereum.org> | 2017-05-25 00:34:19 +0800 |
---|---|---|
committer | chriseth <chris@ethereum.org> | 2017-06-08 21:52:44 +0800 |
commit | 97cc968a133247e729ed1d189d35ef2b7b53b3d4 (patch) | |
tree | c2aa552abea75a732e36e0c6b357ea879f35de54 /test/libsolidity/InlineAssembly.cpp | |
parent | 21e0b69dcb189fb52ac4e38959801582e02ca8fd (diff) | |
download | dexon-solidity-97cc968a133247e729ed1d189d35ef2b7b53b3d4.tar dexon-solidity-97cc968a133247e729ed1d189d35ef2b7b53b3d4.tar.gz dexon-solidity-97cc968a133247e729ed1d189d35ef2b7b53b3d4.tar.bz2 dexon-solidity-97cc968a133247e729ed1d189d35ef2b7b53b3d4.tar.lz dexon-solidity-97cc968a133247e729ed1d189d35ef2b7b53b3d4.tar.xz dexon-solidity-97cc968a133247e729ed1d189d35ef2b7b53b3d4.tar.zst dexon-solidity-97cc968a133247e729ed1d189d35ef2b7b53b3d4.zip |
Initial EVM1.5 assembly implementation.
Diffstat (limited to 'test/libsolidity/InlineAssembly.cpp')
-rw-r--r-- | test/libsolidity/InlineAssembly.cpp | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/test/libsolidity/InlineAssembly.cpp b/test/libsolidity/InlineAssembly.cpp index f0543101..88b2d584 100644 --- a/test/libsolidity/InlineAssembly.cpp +++ b/test/libsolidity/InlineAssembly.cpp @@ -481,6 +481,42 @@ BOOST_AUTO_TEST_CASE(revert) BOOST_CHECK(successAssemble("{ revert(0, 0) }")); } +BOOST_AUTO_TEST_CASE(function_calls) +{ + BOOST_CHECK(successAssemble("{ function f() {} }")); + BOOST_CHECK(successAssemble("{ function f() { let y := 2 } }")); + BOOST_CHECK(successAssemble("{ function f() -> z { let y := 2 } }")); + BOOST_CHECK(successAssemble("{ function f(a) { let y := 2 } }")); + BOOST_CHECK(successAssemble("{ function f(a) { let y := a } }")); + BOOST_CHECK(successAssemble("{ function f() -> x, y, z {} }")); + BOOST_CHECK(successAssemble("{ function f(x, y, z) {} }")); + BOOST_CHECK(successAssemble("{ function f(a, b) -> x, y, z { y := a } }")); + BOOST_CHECK(successAssemble("{ function f() {} f() }")); + BOOST_CHECK(successAssemble("{ function f() -> x, y { x := 1 y := 2} let a, b := f() }")); + BOOST_CHECK(successAssemble("{ function f(a, b) -> x, y { x := b y := a } let a, b := f(2, 3) }")); + BOOST_CHECK(successAssemble("{ function rec(a) { rec(sub(a, 1)) } rec(2) }")); + BOOST_CHECK(successAssemble("{ let r := 2 function f() -> x, y { x := 1 y := 2} let a, b := f() b := r }")); +} + +BOOST_AUTO_TEST_CASE(switch_statement) +{ + BOOST_CHECK(successAssemble("{ switch 1 default {} }")); + BOOST_CHECK(successAssemble("{ switch 1 case 1 {} default {} }")); + BOOST_CHECK(successAssemble("{ switch 1 case 1 {} }")); + BOOST_CHECK(successAssemble("{ let a := 3 switch a case 1 { a := 1 } case 2 { a := 5 } a := 9}")); + BOOST_CHECK(successAssemble("{ let a := 2 switch calldataload(0) case 1 { a := 1 } case 2 { a := 5 } }")); +} + +BOOST_AUTO_TEST_CASE(large_constant) +{ + auto source = R"({ + switch mul(1, 2) + case 0x0000000000000000000000000000000000000000000000000000000026121ff0 { + } + })"; + BOOST_CHECK(successAssemble(source)); +} + BOOST_AUTO_TEST_CASE(keccak256) { BOOST_CHECK(successAssemble("{ 0 0 keccak256 pop }")); |