mirror of
				https://github.com/ethereum/solidity
				synced 2023-10-03 13:03:40 +00:00 
			
		
		
		
	Tests for cyclic dependencies between constants.
This commit is contained in:
		
							parent
							
								
									573b885337
								
							
						
					
					
						commit
						d089a1ef2b
					
				| @ -5156,6 +5156,34 @@ BOOST_AUTO_TEST_CASE(address_methods) | |||||||
| 	CHECK_SUCCESS(text); | 	CHECK_SUCCESS(text); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | BOOST_AUTO_TEST_CASE(cyclic_dependency_for_constants) | ||||||
|  | { | ||||||
|  | 	char const* text = R"( | ||||||
|  | 		contract C { | ||||||
|  | 			uint constant a = a; | ||||||
|  | 		} | ||||||
|  | 	)"; | ||||||
|  | 	CHECK_ERROR(text, TypeError, "cyclic dependency via a"); | ||||||
|  | 	text = R"( | ||||||
|  | 		contract C { | ||||||
|  | 			uint constant a = b * c; | ||||||
|  | 			uint constant b = 7; | ||||||
|  | 			uint constant c = b + uint(sha3(d)); | ||||||
|  | 			uint constant d = 2 + a; | ||||||
|  | 		} | ||||||
|  | 	)"; | ||||||
|  | 	CHECK_ERROR_ALLOW_MULTI(text, TypeError, "a has a cyclic dependency via c"); | ||||||
|  | 	text = R"( | ||||||
|  | 		contract C { | ||||||
|  | 			uint constant a = b * c; | ||||||
|  | 			uint constant b = 7; | ||||||
|  | 			uint constant c = 4 + uint(sha3(d)); | ||||||
|  | 			uint constant d = 2 + b; | ||||||
|  | 		} | ||||||
|  | 	)"; | ||||||
|  | 	CHECK_SUCCESS(text); | ||||||
|  | } | ||||||
|  | 
 | ||||||
| BOOST_AUTO_TEST_SUITE_END() | BOOST_AUTO_TEST_SUITE_END() | ||||||
| 
 | 
 | ||||||
| } | } | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user