mirror of
				https://github.com/ethereum/solidity
				synced 2023-10-03 13:03:40 +00:00 
			
		
		
		
	test: add a test passing an invalid boolean value as an event argument
Fixes #1381
This commit is contained in:
		
							parent
							
								
									fdc9ef14ad
								
							
						
					
					
						commit
						4dfc413b8e
					
				| @ -3706,6 +3706,7 @@ BOOST_AUTO_TEST_CASE(storing_invalid_boolean) | ||||
| { | ||||
| 	char const* sourceCode = R"( | ||||
| 		contract C { | ||||
| 			event Ev(bool); | ||||
| 			bool public perm; | ||||
| 			function set() returns(uint) { | ||||
| 				bool tmp; | ||||
| @ -3722,12 +3723,26 @@ BOOST_AUTO_TEST_CASE(storing_invalid_boolean) | ||||
| 				} | ||||
| 				return tmp; | ||||
| 			} | ||||
| 			function ev() returns(uint) { | ||||
| 				bool tmp; | ||||
| 				assembly { | ||||
| 					tmp := 5 | ||||
| 				} | ||||
| 				Ev(tmp); | ||||
| 				return 1; | ||||
| 			} | ||||
| 		} | ||||
| 	)"; | ||||
| 	compileAndRun(sourceCode); | ||||
| 	BOOST_CHECK(callContractFunction("set()") == encodeArgs(1)); | ||||
| 	BOOST_CHECK(callContractFunction("perm()") == encodeArgs(1)); | ||||
| 	BOOST_CHECK(callContractFunction("ret()") == encodeArgs(1)); | ||||
| 	BOOST_CHECK(callContractFunction("ev()") == encodeArgs(1)); | ||||
| 	BOOST_REQUIRE_EQUAL(m_logs.size(), 1); | ||||
| 	BOOST_CHECK_EQUAL(m_logs[0].address, m_contractAddress); | ||||
| 	BOOST_CHECK(m_logs[0].data == encodeArgs(1)); | ||||
| 	BOOST_REQUIRE_EQUAL(m_logs[0].topics.size(), 1); | ||||
| 	BOOST_CHECK_EQUAL(m_logs[0].topics[0], dev::keccak256(string("Ev(bool)"))); | ||||
| } | ||||
| 
 | ||||
| 
 | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user