forked from TrueCloudLab/neoneo-go
vm: enable assign/binary/numeric/struct tests
These were not used for some reason.
This commit is contained in:
parent
0309cff5a2
commit
9b421874ae
5 changed files with 35 additions and 3 deletions
|
@ -1,6 +1,9 @@
|
|||
package vm_test
|
||||
|
||||
import "math/big"
|
||||
import (
|
||||
"math/big"
|
||||
"testing"
|
||||
)
|
||||
|
||||
var assignTestCases = []testCase{
|
||||
{
|
||||
|
@ -126,3 +129,7 @@ var assignTestCases = []testCase{
|
|||
big.NewInt(3),
|
||||
},
|
||||
}
|
||||
|
||||
func TestAssignments(t *testing.T) {
|
||||
run_testcases(t, assignTestCases)
|
||||
}
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
package vm_test
|
||||
|
||||
import "math/big"
|
||||
import (
|
||||
"math/big"
|
||||
"testing"
|
||||
)
|
||||
|
||||
var binaryExprTestCases = []testCase{
|
||||
{
|
||||
|
@ -114,3 +117,7 @@ var binaryExprTestCases = []testCase{
|
|||
big.NewInt(0),
|
||||
},
|
||||
}
|
||||
|
||||
func TestBinaryExprs(t *testing.T) {
|
||||
run_testcases(t, binaryExprTestCases)
|
||||
}
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
package vm_test
|
||||
|
||||
import "math/big"
|
||||
import (
|
||||
"math/big"
|
||||
"testing"
|
||||
)
|
||||
|
||||
var numericTestCases = []testCase{
|
||||
{
|
||||
|
@ -16,3 +19,7 @@ var numericTestCases = []testCase{
|
|||
big.NewInt(6),
|
||||
},
|
||||
}
|
||||
|
||||
func TestNumericExprs(t *testing.T) {
|
||||
run_testcases(t, numericTestCases)
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@ package vm_test
|
|||
|
||||
import (
|
||||
"math/big"
|
||||
"testing"
|
||||
|
||||
"github.com/CityOfZion/neo-go/pkg/vm"
|
||||
)
|
||||
|
@ -237,3 +238,7 @@ var structTestCases = []testCase{
|
|||
big.NewInt(14),
|
||||
},
|
||||
}
|
||||
|
||||
func TestStructs(t *testing.T) {
|
||||
run_testcases(t, structTestCases)
|
||||
}
|
||||
|
|
|
@ -16,6 +16,12 @@ type testCase struct {
|
|||
result interface{}
|
||||
}
|
||||
|
||||
func run_testcases(t *testing.T, tcases []testCase) {
|
||||
for _, tcase := range tcases {
|
||||
t.Run(tcase.name, func(t *testing.T) {eval(t, tcase.src, tcase.result)})
|
||||
}
|
||||
}
|
||||
|
||||
func eval(t *testing.T, src string, result interface{}) {
|
||||
vm := vmAndCompile(t, src)
|
||||
vm.Run()
|
||||
|
|
Loading…
Reference in a new issue