go-pattern-examples/behavior/19_interpreter/interpreter_test.go

14 lines
239 B
Go
Raw Normal View History

2020-04-21 17:50:21 +03:00
package interpreter
import "testing"
func TestInterpreter(t *testing.T) {
p := &Parser{}
p.Parse("1 + 2 + 3 - 4 + 5 - 6")
res := p.Result().Interpret()
expect := 1
if res != expect {
t.Fatalf("expect %d got %d", expect, res)
}
}