diff options
author | Lefteris Karapetsas <lefteris@refu.co> | 2015-02-07 00:25:29 +0800 |
---|---|---|
committer | Lefteris Karapetsas <lefteris@refu.co> | 2015-02-07 00:25:29 +0800 |
commit | 895b5c13f0189106f71b670affab61b389e7991d (patch) | |
tree | b3aaa853d84764106aeba01e4a8f4ef8240e2d3f | |
parent | 0037a7694af0f93faf9f98b801faf87a513abd10 (diff) | |
download | dexon-solidity-895b5c13f0189106f71b670affab61b389e7991d.tar.gz dexon-solidity-895b5c13f0189106f71b670affab61b389e7991d.tar.zst dexon-solidity-895b5c13f0189106f71b670affab61b389e7991d.zip |
Small fixes for proper multitype/multiarg SHA3
-rw-r--r-- | SolidityEndToEndTest.cpp | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/SolidityEndToEndTest.cpp b/SolidityEndToEndTest.cpp index bd473af5..0fd71ac5 100644 --- a/SolidityEndToEndTest.cpp +++ b/SolidityEndToEndTest.cpp @@ -576,7 +576,7 @@ BOOST_AUTO_TEST_CASE(simple_mapping) " }\n" "}"; compileAndRun(sourceCode); - + BOOST_CHECK(callContractFunction("get(uint8)", byte(0)) == encodeArgs(byte(0x00))); BOOST_CHECK(callContractFunction("get(uint8)", byte(0x01)) == encodeArgs(byte(0x00))); BOOST_CHECK(callContractFunction("get(uint8)", byte(0xa7)) == encodeArgs(byte(0x00))); @@ -933,7 +933,7 @@ BOOST_AUTO_TEST_CASE(multiple_elementary_accessors) compileAndRun(sourceCode); BOOST_CHECK(callContractFunction("data()") == encodeArgs(8)); BOOST_CHECK(callContractFunction("name()") == encodeArgs("Celina")); - BOOST_CHECK(callContractFunction("a_hash()") == encodeArgs(dev::sha3(toBigEndian(u256(123))))); + BOOST_CHECK(callContractFunction("a_hash()") == encodeArgs(dev::sha3(bytes({0x7b})))); BOOST_CHECK(callContractFunction("an_address()") == encodeArgs(toBigEndian(u160(0x1337)))); BOOST_CHECK(callContractFunction("super_secret_data()") == bytes()); } @@ -2127,8 +2127,8 @@ BOOST_AUTO_TEST_CASE(sha3_multiple_arguments_with_numeric_literals) BOOST_CHECK(callContractFunction("foo(uint256,uint16)", 10, 12) == encodeArgs( dev::sha3( toBigEndian(u256(10)) + - toBigEndian(u256(12)) + - toBigEndian(u256(145))))); + bytes({0x0, 0xc}) + + bytes({0x91})))); } BOOST_AUTO_TEST_CASE(sha3_multiple_arguments_with_string_literals) @@ -2147,14 +2147,13 @@ BOOST_AUTO_TEST_CASE(sha3_multiple_arguments_with_string_literals) compileAndRun(sourceCode); BOOST_CHECK(callContractFunction("foo()") == encodeArgs(dev::sha3("foo"))); -#if 0 // work in progress + BOOST_CHECK(callContractFunction("bar(uint256,uint16)", 10, 12) == encodeArgs( dev::sha3( toBigEndian(u256(10)) + - toBigEndian(u256(12)) + - toBigEndian(u256(145)) + - asBytes("foo"))))); -#endif + bytes({0x0, 0xc}) + + bytes({0x91}) + + bytes({0x66, 0x6f, 0x6f})))); } BOOST_AUTO_TEST_SUITE_END() |