mirror of
https://github.com/Estom/notes.git
synced 2026-04-08 13:30:31 +08:00
go知识重新整理
This commit is contained in:
19
Go/DesignPattern/interpreter/interpreter_test.go
Normal file
19
Go/DesignPattern/interpreter/interpreter_test.go
Normal file
@@ -0,0 +1,19 @@
|
||||
/**
|
||||
* @Author:zhoutao
|
||||
* @Date:2020/12/12 下午3:35
|
||||
* @Desc:
|
||||
*/
|
||||
|
||||
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)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user