Skip to content

Commit

Permalink
test: multi test
Browse files Browse the repository at this point in the history
  • Loading branch information
zoep committed Oct 19, 2023
1 parent 1ef09b8 commit 914e7f3
Show file tree
Hide file tree
Showing 2 changed files with 71 additions and 1 deletion.
52 changes: 51 additions & 1 deletion tests/hevm/pass/multi3/multi3.act
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,17 @@ iff
returns
pre(x)

behaviour add_x of A
interface add_x(uint y)

iff
CALLVALUE == 0
inRange(uint256, x + y)

storage

x => x + y


// contract B
constructor of B
Expand All @@ -30,6 +41,29 @@ iff

creates
uint z := i + 42
A a := create A(i)

behaviour incr_z of B
interface incr_z()

iff
CALLVALUE == 0
inRange(uint256, z + 1)

storage

z => z + 1

behaviour a_add_x of B
interface a_add_x(uint y)

iff
CALLVALUE == 0
inRange(uint256, a.x + y)

storage

a.x => a.x + y


// contract C
Expand All @@ -44,4 +78,20 @@ iff
creates
uint y := 0
A a := create A(u)
B b := create B(u)
B b := create B(u)


behaviour remote of C
interface remote(uint z)

iff
CALLVALUE == 0
inRange(uint256, b.z + 1)
inRange(uint256, b.a.x + z)

storage

b.z => b.z + 1
b.a.x => b.a.x + z

returns z
20 changes: 20 additions & 0 deletions tests/hevm/pass/multi3/multi3.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,28 @@ contract A {
constructor (uint z) {
x = z + 1;
}

function add_x(uint y) public {
x = x + y;
}
}

contract B {
uint z;
A a;

constructor (uint i) {
z = i + 42;
a = new A(i);
}

function incr_z() public {
z = z + 1;
}

function a_add_x(uint y) public {
a.add_x(y);
}
}

contract C {
Expand All @@ -26,4 +39,11 @@ contract C {
a = new A(u);
b = new B(u);
}

function remote(uint z) public returns (uint) {
b.incr_z();
b.a_add_x(z);
return z;
}
}

0 comments on commit 914e7f3

Please sign in to comment.