Text: Update and add tests for short words

This commit is contained in:
Michael Mayer 2021-09-20 22:27:18 +02:00
parent 534517a3d7
commit 0de2a492bb
2 changed files with 24 additions and 0 deletions

View file

@ -262,6 +262,7 @@ var ShortWords = map[string]bool{
"bks": true,
"bkt": true,
"bl": true,
"bla": true,
"bld": true,
"blk": true,
"blo": true,
@ -1267,6 +1268,7 @@ var ShortWords = map[string]bool{
"kin": true,
"kip": true,
"kit": true,
"kuh": true,
"kyu": true,
"kl": true,
"kln": true,
@ -1546,6 +1548,7 @@ var ShortWords = map[string]bool{
"mus": true,
"mut": true,
"mux": true,
"muh": true,
"mv": true,
"mw": true,
"mwa": true,

View file

@ -6,6 +6,27 @@ import (
"github.com/stretchr/testify/assert"
)
func TestUnknownWord(t *testing.T) {
t.Run("Empty", func(t *testing.T) {
assert.True(t, UnknownWord(""))
})
t.Run("qx", func(t *testing.T) {
assert.True(t, UnknownWord("qx"))
})
t.Run("atz", func(t *testing.T) {
assert.True(t, UnknownWord("atz"))
})
t.Run("xqx", func(t *testing.T) {
assert.True(t, UnknownWord("xqx"))
})
t.Run("桥", func(t *testing.T) {
assert.False(t, UnknownWord("桥"))
})
t.Run("桥船", func(t *testing.T) {
assert.False(t, UnknownWord("桥船"))
})
}
func TestWords(t *testing.T) {
t.Run("桥", func(t *testing.T) {
result := Words("桥")