aboutsummaryrefslogtreecommitdiff
path: root/pkg/interpreter
diff options
context:
space:
mode:
authorJulien Dessaux2021-09-28 21:51:08 +0200
committerJulien Dessaux2021-09-28 21:51:08 +0200
commit0e78f3ba3306800d854b13809830cb933249f0cb (patch)
tree8649f41714ecebc9422ea4026eaaca394f356f7e /pkg/interpreter
parentAdded README (diff)
downloadgofunge98-0e78f3ba3306800d854b13809830cb933249f0cb.tar.gz
gofunge98-0e78f3ba3306800d854b13809830cb933249f0cb.tar.bz2
gofunge98-0e78f3ba3306800d854b13809830cb933249f0cb.zip
Added mycology unit tests
Diffstat (limited to '')
-rw-r--r--pkg/interpreter/mycology_test.go32
1 files changed, 32 insertions, 0 deletions
diff --git a/pkg/interpreter/mycology_test.go b/pkg/interpreter/mycology_test.go
new file mode 100644
index 0000000..49f837c
--- /dev/null
+++ b/pkg/interpreter/mycology_test.go
@@ -0,0 +1,32 @@
+package interpreter
+
+import (
+ "fmt"
+ "os"
+ "testing"
+
+ "git.adyxax.org/adyxax/gofunge98/pkg/field"
+ "git.adyxax.org/adyxax/gofunge98/pkg/pointer"
+ "github.com/stretchr/testify/require"
+)
+
+func TestMycology(t *testing.T) {
+ file, err := os.Open("../../mycology/mycology.b98")
+ if err != nil {
+ t.Skip("mycology test suite not found, skipping")
+ }
+
+ f, err := field.Load(file)
+ require.NoError(t, err)
+ p := pointer.NewPointer()
+ p.Argv = []string{"../../mycology/mycology.b98"}
+ // TODO test expected output
+ output := ""
+ p.CharacterOutput = func(c int) {
+ output += fmt.Sprintf("%c", c)
+ }
+ i := NewInterpreter(f, p)
+
+ v := i.Run()
+ require.Equal(t, 15, v)
+}