Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1f8b40f
commit 7ebbdc1
Showing
4 changed files
with
115 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,4 +3,3 @@ driver-kompiled | |
|
||
/.build/* | ||
!/.build/k | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
contract Test { | ||
int a; | ||
uint b = 5; | ||
bool c =false; | ||
|
||
function f (int x, int m) public returns (int y) { | ||
int sum; | ||
|
||
if (x < 0 ) { | ||
sum = 0; | ||
} | ||
else { | ||
sum = x + f(x - 1, m); | ||
b = b + 1; | ||
} | ||
|
||
return sum; | ||
} | ||
} | ||
|
||
contract Move { | ||
address target; | ||
|
||
constructor(address addr) public { | ||
target = addr; | ||
} | ||
|
||
function transferTest(int amount) public returns (bool result) { | ||
if(this.balance > amount){ | ||
target.transfer(amount); | ||
return true; | ||
} | ||
else{ | ||
return false; | ||
} | ||
} | ||
} | ||
|
||
|
||
{ | ||
|
||
|
||
"Test1" : { | ||
"exec" : { | ||
"code" : #solidity( | ||
address addr = new Test(); | ||
addr.transfer(100); | ||
int balance1 = addr.balance; | ||
|
||
address addr2 = new Move(addr); | ||
addr2.transfer(200); | ||
|
||
Move t2 = Move(addr2); | ||
bool result = t2.transferTest(10); | ||
int balance2 = addr.balance; | ||
int balance3 = addr2.balance; | ||
) | ||
}, | ||
"post" : { | ||
"mem" : { | ||
#exists("balance1", 100), #exists("balance2", 110), | ||
#exists("balance3", 190), #exists("result", true) | ||
} | ||
} | ||
}, | ||
|
||
|
||
"Test2" : { | ||
"exec" : { | ||
"code" : #solidity( | ||
address addr = new Test(); | ||
addr.transfer(100); | ||
int balance1 = addr.balance; | ||
|
||
address addr2 = new Move(addr); | ||
addr2.transfer(200); | ||
|
||
Move t2 = Move(addr2); | ||
bool result = t2.transferTest(300); | ||
int balance2 = addr.balance; | ||
int balance3 = addr2.balance; | ||
) | ||
}, | ||
"post" : { | ||
"mem" : { #exists("balance1", 100), #exists("balance2", 100), #exists("balance3", 200), #exists("result", false) } | ||
} | ||
} | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
|
||
{ | ||
|
||
"Test1" : { | ||
"exec" : { | ||
"code" : #solidity( | ||
bool s ; int b; int a; a = 3; b = 4; s = a > b; | ||
) | ||
}, | ||
"post" : { | ||
"mem" : #exists("s",false), | ||
"mem" : #exists("a",3), | ||
"mem" : #exists("b", 4) | ||
} | ||
} | ||
|
||
} |