aboutsummaryrefslogtreecommitdiff
path: root/pkg/interpreter/mycology_test.go
blob: 49f837c8433bedf7880663f597c8604db78f52e6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
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)
}