prosper/words_test.go

26 lines
377 B
Go
Raw Normal View History

2021-02-14 02:09:56 +00:00
package main
import "testing"
func TestDictionary(t *testing.T) {
d := Dictionary{}
2021-02-20 20:52:27 +00:00
d.AddWord("INC", Word{
Name: "INC",
Source: []string{"1", "+"},
})
2021-02-14 02:09:56 +00:00
w, err := d.GetWord("INC")
if err != nil {
t.Fail()
}
if w.Name != "INC" {
t.Fail()
}
if w.Impl != nil {
t.Fail()
}
if len(w.Source) != 2 || w.Source[0] != "1" || w.Source[1] != "+" {
2021-02-14 02:09:56 +00:00
t.Fail()
}
}