aboutsummaryrefslogtreecommitdiffstats
path: root/test/libsolidity
diff options
context:
space:
mode:
authorAlex Beregszaszi <alex@rtfs.hu>2016-10-06 19:08:25 +0800
committerYoichi Hirai <i@yoichihirai.com>2016-10-06 22:34:41 +0800
commit34df80c502c5e20fda6db1d2152beccdfb3342cc (patch)
tree1952c30abb077da548d64a80d121d2ecf1287f2b /test/libsolidity
parente69173f910e8454a7dc13f79598e7e9fd5c147c9 (diff)
downloaddexon-solidity-34df80c502c5e20fda6db1d2152beccdfb3342cc.tar.gz
dexon-solidity-34df80c502c5e20fda6db1d2152beccdfb3342cc.tar.zst
dexon-solidity-34df80c502c5e20fda6db1d2152beccdfb3342cc.zip
Add alias keccak256() for sha3()
Diffstat (limited to 'test/libsolidity')
-rw-r--r--test/libsolidity/SolidityEndToEndTest.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/test/libsolidity/SolidityEndToEndTest.cpp b/test/libsolidity/SolidityEndToEndTest.cpp
index 23bd2abc..9485c5fa 100644
--- a/test/libsolidity/SolidityEndToEndTest.cpp
+++ b/test/libsolidity/SolidityEndToEndTest.cpp
@@ -2872,6 +2872,24 @@ BOOST_AUTO_TEST_CASE(iterated_sha3_with_bytes)
));
}
+BOOST_AUTO_TEST_CASE(keccak256_multiple_arguments)
+{
+ char const* sourceCode = R"(
+ contract c {
+ function foo(uint a, uint b, uint c) returns (bytes32 d)
+ {
+ d = keccak256(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_CASE(generic_call)
{
char const* sourceCode = R"**(