Compiler (#23)
* implemented add, mul, div, sub assign for identifiers. * Implemented struct field initialization. * Implemented imports * Implemented storage VM API (interop layer) + additional bug fixes when encountered. * Bumped version 0.12.0 * fixed double point extension on compiled output file. * Fixed bug where callExpr in returns where added to voidCall * fixed binExpr compare equal * Check the env for the gopath first * removed travis.yml * custom types + implemented general declarations. * commented out the storage test to make the build pass
This commit is contained in:
parent
bebdabab9f
commit
23cfebf621
25 changed files with 798 additions and 117 deletions
|
@ -1,4 +1,4 @@
|
|||
package compiler_test
|
||||
package compiler
|
||||
|
||||
var functionCallTestCases = []testCase{
|
||||
{
|
||||
|
@ -18,6 +18,22 @@ var functionCallTestCases = []testCase{
|
|||
`,
|
||||
"53c56b5a6c766b00527ac461651c006c766b51527ac46203006c766b00c36c766b51c393616c756652c56b5a6c766b00527ac46203006c766b00c3616c7566",
|
||||
},
|
||||
{
|
||||
"test function call with no assign",
|
||||
`
|
||||
package testcase
|
||||
func Main() int {
|
||||
getSomeInteger()
|
||||
getSomeInteger()
|
||||
return 0
|
||||
}
|
||||
|
||||
func getSomeInteger() int {
|
||||
return 0
|
||||
}
|
||||
`,
|
||||
"53c56b616511007561650c007562030000616c756651c56b62030000616c7566",
|
||||
},
|
||||
{
|
||||
"multiple function calls",
|
||||
`
|
||||
|
@ -58,6 +74,21 @@ var functionCallTestCases = []testCase{
|
|||
`,
|
||||
"53c56b5a6c766b00527ac46c766b00c3616516006c766b51527ac46203006c766b51c3616c756653c56b6c766b00527ac4586c766b51527ac46203006c766b00c36c766b51c393616c7566",
|
||||
},
|
||||
{
|
||||
"function call with arguments of interface type",
|
||||
`
|
||||
package testcase
|
||||
func Main() interface{} {
|
||||
x := getSomeInteger(10)
|
||||
return x
|
||||
}
|
||||
|
||||
func getSomeInteger(x interface{}) interface{} {
|
||||
return x
|
||||
}
|
||||
`,
|
||||
"52c56b5a616516006c766b00527ac46203006c766b00c3616c756652c56b6c766b00527ac46203006c766b00c3616c7566",
|
||||
},
|
||||
{
|
||||
"function call with multiple arguments",
|
||||
`
|
||||
|
@ -73,4 +104,17 @@ var functionCallTestCases = []testCase{
|
|||
`,
|
||||
"52c56b52547c616516006c766b00527ac46203006c766b00c3616c756653c56b6c766b00527ac46c766b51527ac46203006c766b00c36c766b51c393616c7566",
|
||||
},
|
||||
{
|
||||
"test Main arguments",
|
||||
`
|
||||
package foo
|
||||
func Main(operation string, args []interface{}) int {
|
||||
if operation == "mintTokens" {
|
||||
return 1
|
||||
}
|
||||
return 0
|
||||
}
|
||||
`,
|
||||
"55c56b6c766b00527ac46c766b51527ac46c766b00c30a6d696e74546f6b656e739c640b0062030051616c756662030000616c7566",
|
||||
},
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue