Move go.mod to top level

This commit is contained in:
Ian Gulliver
2021-11-18 17:44:40 -10:00
parent bacbcc38d8
commit 8e34c67f11
7 changed files with 9 additions and 79 deletions

View File

@@ -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
)

View File

@@ -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=

View File

@@ -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))
}
}