mirror of
				https://github.com/ethereum/solidity
				synced 2023-10-03 13:03:40 +00:00 
			
		
		
		
	Merge pull request #1761 from chriseth/sol_fix_deleteBytes
Fix for deleting byte array elements.
This commit is contained in:
		
						commit
						717f255969
					
				| @ -3381,6 +3381,26 @@ BOOST_AUTO_TEST_CASE(bytes_index_access) | ||||
| 	BOOST_CHECK(callContractFunction("storageWrite()") == encodeArgs(0x193)); | ||||
| } | ||||
| 
 | ||||
| BOOST_AUTO_TEST_CASE(bytes_delete_element) | ||||
| { | ||||
| 	char const* sourceCode = R"( | ||||
| 		contract c { | ||||
| 			bytes data; | ||||
| 			function test1() external returns (bool) { | ||||
| 				data.length = 100; | ||||
| 				for (uint i = 0; i < data.length; i++) | ||||
| 					data[i] = byte(i); | ||||
| 				delete data[94]; | ||||
| 				delete data[96]; | ||||
| 				delete data[98]; | ||||
| 				return data[94] == 0 && data[95] == 95 && data[96] == 0 && data[97] == 97; | ||||
| 			} | ||||
| 		} | ||||
| 	)"; | ||||
| 	compileAndRun(sourceCode); | ||||
| 	BOOST_CHECK(callContractFunction("test1()") == encodeArgs(true)); | ||||
| } | ||||
| 
 | ||||
| BOOST_AUTO_TEST_CASE(array_copy_calldata_storage) | ||||
| { | ||||
| 	char const* sourceCode = R"( | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user