diff options
author | Lefteris Karapetsas <lefteris@refu.co> | 2015-02-03 21:02:58 +0800 |
---|---|---|
committer | Lefteris Karapetsas <lefteris@refu.co> | 2015-02-06 16:38:04 +0800 |
commit | 1bf8660bdf9c126126737acebcf57f34ffb8c205 (patch) | |
tree | 5f9299869acde982ef7f358b818f1b6f34606ba5 | |
parent | 3d98ea22663ef87cffc032f6bf921039e959c293 (diff) | |
download | dexon-solidity-1bf8660bdf9c126126737acebcf57f34ffb8c205.tar dexon-solidity-1bf8660bdf9c126126737acebcf57f34ffb8c205.tar.gz dexon-solidity-1bf8660bdf9c126126737acebcf57f34ffb8c205.tar.bz2 dexon-solidity-1bf8660bdf9c126126737acebcf57f34ffb8c205.tar.lz dexon-solidity-1bf8660bdf9c126126737acebcf57f34ffb8c205.tar.xz dexon-solidity-1bf8660bdf9c126126737acebcf57f34ffb8c205.tar.zst dexon-solidity-1bf8660bdf9c126126737acebcf57f34ffb8c205.zip |
Solidity SHA3 can now take multiple arguments
-rw-r--r-- | SolidityEndToEndTest.cpp | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/SolidityEndToEndTest.cpp b/SolidityEndToEndTest.cpp index f248a5a0..824519fd 100644 --- a/SolidityEndToEndTest.cpp +++ b/SolidityEndToEndTest.cpp @@ -2095,6 +2095,25 @@ BOOST_AUTO_TEST_CASE(event_lots_of_data) BOOST_CHECK_EQUAL(m_logs[0].topics[0], dev::sha3(string("Deposit(address,hash256,uint256,bool)"))); } +BOOST_AUTO_TEST_CASE(sha3_multiple_arguments) +{ + char const* sourceCode = R"( + contract c { + // function foo(uint a) returns (hash d) + function foo(uint a, uint b, uint c) returns (hash d) + { + d = sha3(a, b, c); + } + })"; + compileAndRun(sourceCode); + + BOOST_CHECK(callContractFunction("foo(uint256,uint256,uint256)", 10 , 12, 13) == encodeArgs( + dev::sha3( + toBigEndian(u256(10)) + + toBigEndian(u256(12)) + + toBigEndian(u256(13))))); +} + BOOST_AUTO_TEST_SUITE_END() } |