diff options
author | liana <liana@ethdev.com> | 2015-01-26 20:24:16 +0800 |
---|---|---|
committer | liana <liana@ethdev.com> | 2015-01-26 20:24:16 +0800 |
commit | f5b739da9a7ae3a1dac4532b7616e11a64722cbe (patch) | |
tree | 0710c92ef55d7f5bd455b8f7a5862b1f57390145 | |
parent | 5076f532d8f0989e394452b40186888b30ad70ab (diff) | |
download | dexon-solidity-f5b739da9a7ae3a1dac4532b7616e11a64722cbe.tar.gz dexon-solidity-f5b739da9a7ae3a1dac4532b7616e11a64722cbe.tar.zst dexon-solidity-f5b739da9a7ae3a1dac4532b7616e11a64722cbe.zip |
- modifications according to PR review
-rw-r--r-- | SolidityEndToEndTest.cpp | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/SolidityEndToEndTest.cpp b/SolidityEndToEndTest.cpp index b0b45073..1d483963 100644 --- a/SolidityEndToEndTest.cpp +++ b/SolidityEndToEndTest.cpp @@ -949,9 +949,6 @@ BOOST_AUTO_TEST_CASE(convert_string_to_string) } })"; compileAndRun(sourceCode); - string s = "abc"; - auto res = callContractFunction("pipeTrough(string3)", "abc"); - auto goldenRes = encodeArgs(s); BOOST_CHECK(callContractFunction("pipeTrough(string3)", "abc") == encodeArgs("abc")); } @@ -977,8 +974,8 @@ BOOST_AUTO_TEST_CASE(convert_hash_to_string_different_size) } })"; compileAndRun(sourceCode); - BOOST_CHECK(callContractFunction("hashToString(hash160)", u160("0x00000000000000616263")) == - encodeArgs(u256("0x0000000000000000000000000000000000616263000000000000000000000000"))); + BOOST_CHECK(callContractFunction("hashToString(hash160)", u160("0x6161626361626361626361616263616263616263")) == + encodeArgs(string("aabcabcabcaabcabcabc"))); } BOOST_AUTO_TEST_CASE(convert_string_to_hash_same_size) @@ -1003,8 +1000,22 @@ BOOST_AUTO_TEST_CASE(convert_string_to_hash_different_size) } })"; compileAndRun(sourceCode); - BOOST_CHECK(callContractFunction("stringToHash(string20)", u256("0x0000000000000000000000000000000000616263000000000000000000000000")) == - encodeArgs(u160("0x00000000000000616263"))); + BOOST_CHECK(callContractFunction("stringToHash(string20)", string("aabcabcabcaabcabcabc")) == + encodeArgs(u160("0x6161626361626361626361616263616263616263"))); +} + + +BOOST_AUTO_TEST_CASE(convert_string_to_hash_different_min_size) +{ + char const* sourceCode = R"( + contract Test { + function stringToHash(string1 s) returns (hash8 h) { + return hash8(s); + } + })"; + compileAndRun(sourceCode); + BOOST_CHECK(callContractFunction("stringToHash(string1)", string("a")) == + encodeArgs(u128("0x00000000000000000000000000000061"))); } BOOST_AUTO_TEST_CASE(send_ether) |