mirror of
https://github.com/crazybber/go-pattern-examples.git
synced 2024-11-29 15:06:02 +03:00
14 lines
239 B
Go
14 lines
239 B
Go
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)
|
|
}
|
|
}
|