diff options
author | chriseth <c@ethdev.com> | 2016-11-09 20:34:51 +0800 |
---|---|---|
committer | chriseth <c@ethdev.com> | 2016-11-16 21:37:18 +0800 |
commit | e1df3bd77f78d5564fc173474015e5d84b192824 (patch) | |
tree | 7651d6e931d2ff3ebe7d518c77dc59189f0ff2ae /test | |
parent | f21f794f3c380c9382ace4908c38d0f6c776ae17 (diff) | |
download | dexon-solidity-e1df3bd77f78d5564fc173474015e5d84b192824.tar dexon-solidity-e1df3bd77f78d5564fc173474015e5d84b192824.tar.gz dexon-solidity-e1df3bd77f78d5564fc173474015e5d84b192824.tar.bz2 dexon-solidity-e1df3bd77f78d5564fc173474015e5d84b192824.tar.lz dexon-solidity-e1df3bd77f78d5564fc173474015e5d84b192824.tar.xz dexon-solidity-e1df3bd77f78d5564fc173474015e5d84b192824.tar.zst dexon-solidity-e1df3bd77f78d5564fc173474015e5d84b192824.zip |
Fix tests.
Diffstat (limited to 'test')
-rw-r--r-- | test/libsolidity/SolidityEndToEndTest.cpp | 31 |
1 files changed, 22 insertions, 9 deletions
diff --git a/test/libsolidity/SolidityEndToEndTest.cpp b/test/libsolidity/SolidityEndToEndTest.cpp index a1236803..8f9edadf 100644 --- a/test/libsolidity/SolidityEndToEndTest.cpp +++ b/test/libsolidity/SolidityEndToEndTest.cpp @@ -7878,19 +7878,20 @@ BOOST_AUTO_TEST_CASE(mapping_of_functions) stages[msg.sender] = stage0; } - function f() { + function f() returns (uint) { stages[msg.sender](); + return 7; } } )"; compileAndRun(sourceCode, 0, "Flow"); - BOOST_CHECK(callContractFunction("checkSuccess()") == encodeArgs(false)); - BOOST_CHECK(callContractFunction("f()") == encodeArgs()); - BOOST_CHECK(callContractFunction("f()") == encodeArgs()); - BOOST_CHECK(callContractFunction("checkSuccess()") == encodeArgs(false)); - BOOST_CHECK(callContractFunction("f()") == encodeArgs()); - BOOST_CHECK(callContractFunction("checkSuccess()") == encodeArgs(true)); + BOOST_CHECK(callContractFunction("success()") == encodeArgs(false)); + BOOST_CHECK(callContractFunction("f()") == encodeArgs(u256(7))); + BOOST_CHECK(callContractFunction("f()") == encodeArgs(u256(7))); + BOOST_CHECK(callContractFunction("success()") == encodeArgs(false)); + BOOST_CHECK(callContractFunction("f()") == encodeArgs(u256(7))); + BOOST_CHECK(callContractFunction("success()") == encodeArgs(true)); } BOOST_AUTO_TEST_CASE(packed_functions) @@ -7900,12 +7901,16 @@ BOOST_AUTO_TEST_CASE(packed_functions) // these should take the same slot function() returns (uint) a; function() external returns (uint) b; + function() external returns (uint) c; + function() returns (uint) d; uint8 public x; function set() { x = 2; + d = g; + c = this.h; + b = this.h; a = g; - b = h; } function t1() returns (uint) { return a(); @@ -7913,6 +7918,12 @@ BOOST_AUTO_TEST_CASE(packed_functions) function t2() returns (uint) { return b(); } + function t3() returns (uint) { + return a(); + } + function t4() returns (uint) { + return b(); + } function g() returns (uint) { return 7; } @@ -7926,6 +7937,8 @@ BOOST_AUTO_TEST_CASE(packed_functions) BOOST_CHECK(callContractFunction("set()") == encodeArgs()); BOOST_CHECK(callContractFunction("t1()") == encodeArgs(u256(7))); BOOST_CHECK(callContractFunction("t2()") == encodeArgs(u256(8))); + BOOST_CHECK(callContractFunction("t3()") == encodeArgs(u256(7))); + BOOST_CHECK(callContractFunction("t4()") == encodeArgs(u256(8))); BOOST_CHECK(callContractFunction("x()") == encodeArgs(u256(2))); } @@ -7939,7 +7952,7 @@ BOOST_AUTO_TEST_CASE(function_memory_array) function d(uint x) returns (uint) { return x + 5; } function e(uint x) returns (uint) { return x + 8; } function test(uint x, uint i) returns (uint) { - function(uint) internal returns (uint)[] arr = + function(uint) internal returns (uint)[] memory arr = new function(uint) internal returns (uint)[](10); arr[0] = a; arr[1] = b; |