diff options
author | Christian <c@ethdev.com> | 2015-02-10 16:00:50 +0800 |
---|---|---|
committer | Christian <c@ethdev.com> | 2015-02-12 18:33:09 +0800 |
commit | 8787413a86dee8f26077f086506f0010587cf350 (patch) | |
tree | 98c9c4471d05f7af8b77381ffa98fbd8933acecf /SolidityEndToEndTest.cpp | |
parent | d37f6cfb9f04d4148228784521147bf39584be92 (diff) | |
download | dexon-solidity-8787413a86dee8f26077f086506f0010587cf350.tar dexon-solidity-8787413a86dee8f26077f086506f0010587cf350.tar.gz dexon-solidity-8787413a86dee8f26077f086506f0010587cf350.tar.bz2 dexon-solidity-8787413a86dee8f26077f086506f0010587cf350.tar.lz dexon-solidity-8787413a86dee8f26077f086506f0010587cf350.tar.xz dexon-solidity-8787413a86dee8f26077f086506f0010587cf350.tar.zst dexon-solidity-8787413a86dee8f26077f086506f0010587cf350.zip |
Tests and some code for msg.data.
Diffstat (limited to 'SolidityEndToEndTest.cpp')
-rw-r--r-- | SolidityEndToEndTest.cpp | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/SolidityEndToEndTest.cpp b/SolidityEndToEndTest.cpp index 8a21290c..054b0c6a 100644 --- a/SolidityEndToEndTest.cpp +++ b/SolidityEndToEndTest.cpp @@ -2254,6 +2254,31 @@ BOOST_AUTO_TEST_CASE(generic_call) BOOST_CHECK_EQUAL(m_state.balance(m_contractAddress), 50 - 2); } +BOOST_AUTO_TEST_CASE(storing_bytes) +{ + char const* sourceCode = R"( + contract C { + function save() { + savedData = msg.data; + } + function forward() { + this.call(savedData); + } + function clear() { + delete savedData; + } + function doubleIt(uint a) returns (uint b) { return a * 2; } + bytes savedData; + } + )"; + compileAndRun(sourceCode); + FixedHash<4> innerHash(dev::sha3("doubleIt(uint256)")); + BOOST_CHECK(callContractFunction("save()", innerHash.asBytes(), 7) == bytes()); + BOOST_CHECK(callContractFunction("forward()") == encodeArgs(14)); + BOOST_CHECK(callContractFunction("clear()") == bytes()); + BOOST_CHECK(callContractFunction("forward()") == bytes()); +} + BOOST_AUTO_TEST_SUITE_END() } |