-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
assignments, local variables, better tests, other bug fixes (#332)
* formatting the test, removing old code * new test case with less going on * updating primops test case to use local vars not fields * scala style, whitespace, a new util function, comments, variable declaration first cut * updating bool literal test to refer to a local rather than a field * no prizes for guessing where i copied this file from * assign instead of declare; removing type annotations from declarations output with a comment about why * whitespace * similar enough case for decls, so might as well * updating ifthenelse test case to use locals not fields, fixing a bug in the output code * adding case for if, since it\'s so similar to ifthenelse * intconst test to locals not fields * removing sstore for local variables * fixing scaladocs * updating simplecall test to not use fields * adding a top level return to simple call so its testable * scala style * whitespace * removing temp symbol table
- Loading branch information
Showing
12 changed files
with
142 additions
and
72 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 |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"gas" : 30000000, | ||
"gasprice" : "0x9184e72a000", | ||
"startingeth" : 5000000, | ||
"numaccts" : 1 | ||
} |
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,8 @@ | ||
main contract AssignLocalAdd{ | ||
transaction assignlocaladd() { | ||
int x; | ||
bool y; | ||
x = 5 + 12; | ||
return; | ||
} | ||
} |
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 |
---|---|---|
@@ -1,7 +1,6 @@ | ||
main contract BoolLiteral{ | ||
bool x; | ||
|
||
transaction BoolLiteral () { | ||
bool x; | ||
x = true; | ||
x = 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,6 @@ | ||
{ | ||
"gas" : 30000000, | ||
"gasprice" : "0x9184e72a000", | ||
"startingeth" : 5000000, | ||
"numaccts" : 1 | ||
} |
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,9 @@ | ||
main contract If { | ||
transaction iftest() { | ||
int x; | ||
if (true) { | ||
x = 1; | ||
} | ||
return; | ||
} | ||
} |
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 |
---|---|---|
@@ -1,11 +1,11 @@ | ||
main contract IfThenElse { | ||
int x; | ||
transaction ifthenelse() { | ||
int x; | ||
if (true) { | ||
x = 1; | ||
} else { | ||
x = 0; | ||
} | ||
x = 1; | ||
} else { | ||
x = 0; | ||
} | ||
return; | ||
} | ||
} |
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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
main contract IntConst{ | ||
int x; | ||
transaction intconst() { | ||
int x; | ||
x = 4; | ||
return; | ||
} | ||
|
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 |
---|---|---|
@@ -1,28 +1,28 @@ | ||
main contract PrimOps{ | ||
int x; | ||
bool y; | ||
|
||
transaction primops() { | ||
y = true && false; | ||
y = true || false; | ||
int x; | ||
bool y; | ||
|
||
y = true && false; | ||
y = true || false; | ||
|
||
x = 4 + 4; | ||
x = 4 - 4; | ||
x = 4 / 4; | ||
x = 4 * 4; | ||
x = 4 % 4; | ||
x = 4 + 4; | ||
x = 4 - 4; | ||
x = 4 / 4; | ||
x = 4 * 4; | ||
x = 4 % 4; | ||
|
||
y = 1 == 2; | ||
y = 1 != 2; | ||
y = 3 > 4; | ||
y = 3 >= 4; | ||
y = 3 < 3; | ||
y = 3 <= 3; | ||
y = 3 != 3; | ||
y = 1 == 2; | ||
y = 1 != 2; | ||
y = 3 > 4; | ||
y = 3 >= 4; | ||
y = 3 < 3; | ||
y = 3 <= 3; | ||
y = 3 != 3; | ||
|
||
y = !y; | ||
x = - x; | ||
y = !y; | ||
x = - x; | ||
|
||
return; | ||
return; | ||
} | ||
} |
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 |
---|---|---|
@@ -1,12 +1,11 @@ | ||
main contract SimpleCall{ | ||
int x; | ||
transaction updatex() { | ||
x = 4; | ||
return; | ||
transaction val() returns int { | ||
return 4; | ||
} | ||
transaction main(){ | ||
transaction main() returns int{ | ||
int x; | ||
x = 9; | ||
updatex(); | ||
return; | ||
x = val(); | ||
return x; | ||
} | ||
} |
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
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