aboutsummaryrefslogtreecommitdiffstats
path: root/libsolidity/SolidityEndToEndTest.cpp
diff options
context:
space:
mode:
authorchriseth <c@ethdev.com>2015-06-16 22:19:42 +0800
committerchriseth <c@ethdev.com>2015-06-16 22:19:42 +0800
commitbc74cd0a3c0ca6a18ff8bae3f468e45115ae37e1 (patch)
treecaeeade082bc2fb1ca7985c44ad1caae97d80b93 /libsolidity/SolidityEndToEndTest.cpp
parentce60e42f39b94d027ec55d9278409ac7dcff35d5 (diff)
parente7906ba1beecf9fd04d9e3476da7a66d61714629 (diff)
downloaddexon-solidity-bc74cd0a3c0ca6a18ff8bae3f468e45115ae37e1.tar
dexon-solidity-bc74cd0a3c0ca6a18ff8bae3f468e45115ae37e1.tar.gz
dexon-solidity-bc74cd0a3c0ca6a18ff8bae3f468e45115ae37e1.tar.bz2
dexon-solidity-bc74cd0a3c0ca6a18ff8bae3f468e45115ae37e1.tar.lz
dexon-solidity-bc74cd0a3c0ca6a18ff8bae3f468e45115ae37e1.tar.xz
dexon-solidity-bc74cd0a3c0ca6a18ff8bae3f468e45115ae37e1.tar.zst
dexon-solidity-bc74cd0a3c0ca6a18ff8bae3f468e45115ae37e1.zip
Merge pull request #2199 from chriseth/sol_memoryArrays4
Copying between memory and memory.
Diffstat (limited to 'libsolidity/SolidityEndToEndTest.cpp')
-rw-r--r--libsolidity/SolidityEndToEndTest.cpp27
1 files changed, 26 insertions, 1 deletions
diff --git a/libsolidity/SolidityEndToEndTest.cpp b/libsolidity/SolidityEndToEndTest.cpp
index f12abd48..f4d875e7 100644
--- a/libsolidity/SolidityEndToEndTest.cpp
+++ b/libsolidity/SolidityEndToEndTest.cpp
@@ -2420,7 +2420,7 @@ BOOST_AUTO_TEST_CASE(event_really_lots_of_data_from_storage)
callContractFunction("deposit()");
BOOST_REQUIRE_EQUAL(m_logs.size(), 1);
BOOST_CHECK_EQUAL(m_logs[0].address, m_contractAddress);
- BOOST_CHECK(m_logs[0].data == encodeArgs(10, 0x60, 15, 3) + asBytes("ABC"));
+ BOOST_CHECK(m_logs[0].data == encodeArgs(10, 0x60, 15, 3, string("ABC")));
BOOST_REQUIRE_EQUAL(m_logs[0].topics.size(), 1);
BOOST_CHECK_EQUAL(m_logs[0].topics[0], dev::sha3(string("Deposit(uint256,bytes,uint256)")));
}
@@ -4232,6 +4232,31 @@ BOOST_AUTO_TEST_CASE(reusing_memory)
BOOST_REQUIRE(callContractFunction("f(uint256)", 0x34) == encodeArgs(dev::sha3(dev::toBigEndian(u256(0x34)))));
}
+BOOST_AUTO_TEST_CASE(return_string)
+{
+ char const* sourceCode = R"(
+ contract Main {
+ string public s;
+ function set(string _s) external {
+ s = _s;
+ }
+ function get1() returns (string r) {
+ return s;
+ }
+// function get2() returns (string r) {
+// r = s;
+// }
+ }
+ )";
+ compileAndRun(sourceCode, 0, "Main");
+ string s("Julia");
+ bytes args = encodeArgs(u256(0x20), u256(s.length()), s);
+ BOOST_REQUIRE(callContractFunction("set(string)", asString(args)) == encodeArgs());
+ BOOST_CHECK(callContractFunction("get1()") == args);
+// BOOST_CHECK(callContractFunction("get2()") == args);
+// BOOST_CHECK(callContractFunction("s()") == args);
+}
+
BOOST_AUTO_TEST_SUITE_END()
}