From 6247ed36cde2203c8df6c80ed3a7f3124acb883b Mon Sep 17 00:00:00 2001 From: Gea-Suan Lin Date: Fri, 16 Feb 2024 20:43:26 +0800 Subject: [PATCH] Add a simple test case. --- internal/ngram/ngram_test.go | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 internal/ngram/ngram_test.go 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() + } +}