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.
		
			
				
	
	
		
			33 lines
		
	
	
		
			814 B
		
	
	
	
		
			Solidity
		
	
	
	
	
	
			
		
		
	
	
			33 lines
		
	
	
		
			814 B
		
	
	
	
		
			Solidity
		
	
	
	
	
	
| pragma abicoder v2;
 | |
| 
 | |
| contract C {
 | |
| 	struct T {
 | |
| 		uint t;
 | |
| 	}
 | |
| 	struct S {
 | |
| 		uint x;
 | |
| 		T t;
 | |
| 		bool b;
 | |
| 		uint[] a;
 | |
| 	}
 | |
| 
 | |
| 	S public s;
 | |
| 
 | |
| 	function f() public view {
 | |
| 		uint y;
 | |
| 		bool c;
 | |
| 		T memory t;
 | |
| 		(y,t,c) = this.s();
 | |
| 		assert(y == s.x); // this should hold
 | |
| 		assert(c == s.b); // this should hold
 | |
| 		assert(t.t == s.t.t); // this should hold
 | |
| 		assert(c == true); // this should fail
 | |
| 	}
 | |
| }
 | |
| // ====
 | |
| // SMTEngine: all
 | |
| // SMTIgnoreCex: no
 | |
| // ----
 | |
| // Warning 6328: (338-355): CHC: Assertion violation happens here.\nCounterexample:\ns = {x: 0, t: {t: 0}, b: false, a: []}\ny = 0\nc = false\nt = {t: 0}\n\nTransaction trace:\nC.constructor()\nState: s = {x: 0, t: {t: 0}, b: false, a: []}\nC.f()
 | |
| // Info 1391: CHC: 3 verification condition(s) proved safe! Enable the model checker option "show proved safe" to see all of them.
 |