diff --git a/internal/ngram/ngram_test.go b/internal/ngram/ngram_test.go new file mode 100644 index 0000000..5903bee --- /dev/null +++ b/internal/ngram/ngram_test.go @@ -0,0 +1,19 @@ +package ngram_test + +import ( + "testing" + + "github.com/gslin/go-ir-playground/internal/ngram" +) + +func TestUnigram(t *testing.T) { + a := ngram.Unigram("test") + if len(a) != 1 || a[0] != "test" { + t.Error() + } + + a = ngram.Unigram("測試") + if len(a) != 2 || a[0] != "測" || a[1] != "試" { + t.Error() + } +}