mirror of
				https://github.com/ethereum/solidity
				synced 2023-10-03 13:03:40 +00:00 
			
		
		
		
	Copying between memory and memory.
Also fixed some encoding and padding issues with older copying code.
This commit is contained in:
		
							parent
							
								
									fd74541843
								
							
						
					
					
						commit
						e7906ba1be
					
				| @ -106,7 +106,7 @@ BOOST_AUTO_TEST_CASE(location_test) | ||||
| 	AssemblyItems items = compileContract(sourceCode); | ||||
| 	vector<SourceLocation> locations = | ||||
| 		vector<SourceLocation>(17, SourceLocation(2, 75, n)) + | ||||
| 		vector<SourceLocation>(14, SourceLocation(20, 72, n)) + | ||||
| 		vector<SourceLocation>(26, SourceLocation(20, 72, n)) + | ||||
| 		vector<SourceLocation>{SourceLocation(42, 51, n), SourceLocation(65, 67, n)} + | ||||
| 		vector<SourceLocation>(4, SourceLocation(58, 67, n)) + | ||||
| 		vector<SourceLocation>(3, SourceLocation(20, 72, n)); | ||||
|  | ||||
| @ -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() | ||||
| 
 | ||||
| } | ||||
|  | ||||
| @ -174,11 +174,11 @@ protected: | ||||
| 			BOOST_REQUIRE(m_state.addressHasCode(m_contractAddress)); | ||||
| 			BOOST_REQUIRE(!executive.call(m_contractAddress, m_sender, _value, m_gasPrice, &_data, m_gas)); | ||||
| 		} | ||||
| 		BOOST_REQUIRE(executive.go()); | ||||
| 		BOOST_REQUIRE(executive.go(/* DEBUG eth::Executive::simpleTrace() */)); | ||||
| 		m_state.noteSending(m_sender); | ||||
| 		executive.finalize(); | ||||
| 		m_gasUsed = executive.gasUsed(); | ||||
| 		m_output = std::move(res.output); // FIXME: Looks like Framework needs ExecutiveResult embedded
 | ||||
| 		m_gasUsed = res.gasUsed; | ||||
| 		m_output = std::move(res.output); | ||||
| 		m_logs = executive.logs(); | ||||
| 	} | ||||
| 
 | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user