aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian <c@ethdev.com>2015-02-10 17:45:57 +0800
committerChristian <c@ethdev.com>2015-02-10 17:59:23 +0800
commit7dc5e2a1a0ef2c0212d852c053fc52e25c16acd9 (patch)
treee78af7184e950edbe3ceec79f04e3e380c690eb5
parent8f9511c6ec3a7df05188e9aa6322b5ec0932c095 (diff)
downloaddexon-solidity-7dc5e2a1a0ef2c0212d852c053fc52e25c16acd9.tar
dexon-solidity-7dc5e2a1a0ef2c0212d852c053fc52e25c16acd9.tar.gz
dexon-solidity-7dc5e2a1a0ef2c0212d852c053fc52e25c16acd9.tar.bz2
dexon-solidity-7dc5e2a1a0ef2c0212d852c053fc52e25c16acd9.tar.lz
dexon-solidity-7dc5e2a1a0ef2c0212d852c053fc52e25c16acd9.tar.xz
dexon-solidity-7dc5e2a1a0ef2c0212d852c053fc52e25c16acd9.tar.zst
dexon-solidity-7dc5e2a1a0ef2c0212d852c053fc52e25c16acd9.zip
Arbitrary parameters for call() and all hash functions.
-rw-r--r--SolidityEndToEndTest.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/SolidityEndToEndTest.cpp b/SolidityEndToEndTest.cpp
index 5bd1e857..31b80894 100644
--- a/SolidityEndToEndTest.cpp
+++ b/SolidityEndToEndTest.cpp
@@ -2201,6 +2201,29 @@ BOOST_AUTO_TEST_CASE(sha3_multiple_arguments_with_string_literals)
bytes({0x66, 0x6f, 0x6f}))));
}
+BOOST_AUTO_TEST_CASE(generic_call)
+{
+ char const* sourceCode = R"**(
+ contract receiver {
+ uint public received;
+ function receive(uint256 x) { received = x; }
+ }
+ contract sender {
+ function doSend(address rec) returns (uint d)
+ {
+ string4 signature = string4(string32(sha3("receive(uint256)")));
+ rec.call.value(2)(signature, 23);
+ return receiver(rec).received();
+ }
+ }
+ )**";
+ compileAndRun(sourceCode, 0, "receiver");
+ u160 const c_receiverAddress = m_contractAddress;
+ compileAndRun(sourceCode, 50, "sender");
+ BOOST_REQUIRE(callContractFunction("doSend(address)", c_receiverAddress) == encodeArgs(23));
+ BOOST_CHECK_EQUAL(m_state.balance(m_contractAddress), 50 - 2);
+}
+
BOOST_AUTO_TEST_SUITE_END()
}