Move go.mod to top level
This commit is contained in:
@@ -1,8 +0,0 @@
|
||||
module github.com/firestuff/subcoding/vm
|
||||
|
||||
go 1.17
|
||||
|
||||
require (
|
||||
github.com/lunixbochs/struc v0.0.0-20200707160740-784aaebc1d40 // indirect
|
||||
github.com/pkg/errors v0.9.1 // indirect
|
||||
)
|
||||
@@ -1,4 +0,0 @@
|
||||
github.com/lunixbochs/struc v0.0.0-20200707160740-784aaebc1d40 h1:EnfXoSqDfSNJv0VBNqY/88RNnhSGYkrHaO0mmFGbVsc=
|
||||
github.com/lunixbochs/struc v0.0.0-20200707160740-784aaebc1d40/go.mod h1:vy1vK6wD6j7xX6O6hXe621WabdtNkou2h7uRtTfRMyg=
|
||||
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
|
||||
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||
@@ -1,47 +0,0 @@
|
||||
package vm
|
||||
|
||||
import "encoding/hex"
|
||||
import "strings"
|
||||
import "testing"
|
||||
|
||||
func TestFirst(t *testing.T) {
|
||||
asm := [][]string{
|
||||
[]string{
|
||||
"0000020000000000010000000000000000000000000000000000000000000001",
|
||||
"0000000100000000000000000000000000000001000000000000000000000000",
|
||||
"0000030100000000010000000000000000000000000000000000000000000003",
|
||||
"000004010000000000000000fffffffffffffffd000000000000000000000000",
|
||||
},
|
||||
[]string{
|
||||
"0000020000000000020000000000000000000000000000000000000000000001",
|
||||
},
|
||||
}
|
||||
|
||||
functionByteCode := [][]byte{}
|
||||
|
||||
for _, fnc := range asm {
|
||||
fncString := strings.Join(fnc, "")
|
||||
|
||||
byteCode, err := hex.DecodeString(fncString)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
functionByteCode = append(functionByteCode, byteCode)
|
||||
}
|
||||
|
||||
state, err := NewStateFromByteCode(functionByteCode)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
state.Execute()
|
||||
|
||||
if state.err != nil {
|
||||
t.Fatal(state)
|
||||
}
|
||||
|
||||
if state.globalMemory.mustReadUnsigned(0) != 3 {
|
||||
t.Fatal(state.globalMemory.mustReadUnsigned(0))
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user