neoneo-go/pkg/vm/compiler/tests/bool_test.go
Anthony De Meulemeester 2345858238
Compiler update (basic sc ready) (#31)
* refactored structs, the scope is not needed anymore + fix passing struct in func arguments.

* implemented byte arrays and added runtime tests

* Added sc examples in compiler README + added quick nested if test.

* Updated README
2018-02-27 10:04:24 +01:00

57 lines
882 B
Go

package compiler
var boolTestCases = []testCase{
{
"bool assign",
`
package foo
func Main() bool {
x := true
return x
}
`,
"52c56b516c766b00527ac46203006c766b00c3616c7566",
},
{
"bool compare",
`
package foo
func Main() int {
x := true
if x {
return 10
}
return 0
}
`,
"54c56b516c766b00527ac46c766b00c3640b006203005a616c756662030000616c7566",
},
{
"bool compare verbose",
`
package foo
func Main() int {
x := true
if x == true {
return 10
}
return 0
}
`,
"54c56b516c766b00527ac46c766b00c3519c640b006203005a616c756662030000616c7566",
},
// {
// "bool invert (unary expr)",
// `
// package foo
// func Main() int {
// x := true
// if !x {
// return 10
// }
// return 0
// }
// `,
// "54c56b516c766b00527ac46c766b00c3630b006203005a616c756662030000616c7566",
// },
}