mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2025-02-23 15:54:30 +00:00
vm: add tests
This commit is contained in:
parent
b68e9591aa
commit
1458116567
1 changed files with 71 additions and 0 deletions
|
@ -39,6 +39,17 @@ var binaryExprTestCases = []testCase{
|
||||||
`,
|
`,
|
||||||
big.NewInt(1),
|
big.NewInt(1),
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"simple mod",
|
||||||
|
`
|
||||||
|
package testcase
|
||||||
|
func Main() int {
|
||||||
|
x := 3 % 2
|
||||||
|
return x
|
||||||
|
}
|
||||||
|
`,
|
||||||
|
big.NewInt(1),
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"simple mul",
|
"simple mul",
|
||||||
`
|
`
|
||||||
|
@ -186,6 +197,66 @@ var binaryExprTestCases = []testCase{
|
||||||
`,
|
`,
|
||||||
big.NewInt(1),
|
big.NewInt(1),
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"simple add and assign",
|
||||||
|
`
|
||||||
|
package testcase
|
||||||
|
func Main() int {
|
||||||
|
x := 2
|
||||||
|
x += 1
|
||||||
|
return x
|
||||||
|
}
|
||||||
|
`,
|
||||||
|
big.NewInt(3),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"simple sub and assign",
|
||||||
|
`
|
||||||
|
package testcase
|
||||||
|
func Main() int {
|
||||||
|
x := 2
|
||||||
|
x -= 1
|
||||||
|
return x
|
||||||
|
}
|
||||||
|
`,
|
||||||
|
big.NewInt(1),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"simple mul and assign",
|
||||||
|
`
|
||||||
|
package testcase
|
||||||
|
func Main() int {
|
||||||
|
x := 2
|
||||||
|
x *= 2
|
||||||
|
return x
|
||||||
|
}
|
||||||
|
`,
|
||||||
|
big.NewInt(4),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"simple div and assign",
|
||||||
|
`
|
||||||
|
package testcase
|
||||||
|
func Main() int {
|
||||||
|
x := 2
|
||||||
|
x /= 2
|
||||||
|
return x
|
||||||
|
}
|
||||||
|
`,
|
||||||
|
big.NewInt(1),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"simple mod and assign",
|
||||||
|
`
|
||||||
|
package testcase
|
||||||
|
func Main() int {
|
||||||
|
x := 5
|
||||||
|
x %= 2
|
||||||
|
return x
|
||||||
|
}
|
||||||
|
`,
|
||||||
|
big.NewInt(1),
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestBinaryExprs(t *testing.T) {
|
func TestBinaryExprs(t *testing.T) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue