mirror of
				https://github.com/ethereum/solidity
				synced 2023-10-03 13:03:40 +00:00 
			
		
		
		
	Since the default is now to ignore the counterexamples when checking test output, we bring back counterexample checks in tests where the counterexample is (mostly) deterministic.
		
			
				
	
	
		
			25 lines
		
	
	
		
			682 B
		
	
	
	
		
			Solidity
		
	
	
	
	
	
			
		
		
	
	
			25 lines
		
	
	
		
			682 B
		
	
	
	
		
			Solidity
		
	
	
	
	
	
| pragma abicoder v1;
 | |
| struct Item {
 | |
| 	uint x;
 | |
| 	uint y;
 | |
| }
 | |
| 
 | |
| contract D {
 | |
| 	Item[] public items;
 | |
| 
 | |
| 	function test() public {
 | |
| 		delete items;
 | |
| 		items.push(Item(42, 43));
 | |
| 		(uint a, uint b) = this.items(0);
 | |
| 		assert(a == 42); // should hold
 | |
| 		assert(b == 43); // should hold
 | |
| 		assert(b == 0); // should fail
 | |
| 	}
 | |
| }
 | |
| // ====
 | |
| // SMTEngine: all
 | |
| // SMTIgnoreCex: no
 | |
| // ----
 | |
| // Warning 6328: (267-281): CHC: Assertion violation happens here.\nCounterexample:\nitems = [{x: 42, y: 43}]\na = 42\nb = 43\n\nTransaction trace:\nD.constructor()\nState: items = []\nD.test()
 | |
| // Info 1391: CHC: 2 verification condition(s) proved safe! Enable the model checker option "show proved safe" to see all of them.
 |