Add a simple test case.
This commit is contained in:
19
internal/ngram/ngram_test.go
Normal file
19
internal/ngram/ngram_test.go
Normal file
@@ -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()
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user