Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- contract C {
- uint x;
- function f() public {
- require(x + 1 > x);
- ++x;
- }
- function g() public {
- uint y = x;
- f();
- assert(y == (x - 1));
- }
- }
- contract C {
- uint x;
- function f() public {
- require(x + 1 > x);
- ++x;
- }
- function g() public {
- require(x > 10);
- uint y = x;
- uint i = 0;
- for (; i < 10; ++i)
- f();
- assert(y == (x - 10));
- }
- }
- contract A {
- int public s;
- B b;
- constructor() public { s=0; b = new B(this);}
- function f() public {
- require(s+1>s);
- bool status;
- bytes memory result;
- int s0=s;
- (status, result) = address(b).call.gas(10000)(abi.encodePacked(bytes4(keccak256("g()"))));
- assert(s0==s);
- incs();
- assert(s>0);
- }
- function getBs() public view returns(int) {return b.s();}
- function incs() public {s+=1;}
- }
- contract B{
- int public s;
- A a;
- constructor(A _a) public {s=0; a=_a;}
- function g() external {
- s+=1;
- a.incs();
- assert(false);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement