Files
scrabble-solver/wordlist/wordlist_test.go
T
Ilia Denisov 256999b42c Publish as versioned Gitea module; move dictionary pipeline out
- Rename module to gitea.iliadenisov.ru/developer/scrabble-solver so it can be
  consumed as a versioned dependency (no go.work replace / CI clone).
- De-internalize wordlist and dictdawg as public packages.
- Remove cmd/builddict, dictprep/, the dictionaries submodule and the dawg
  Makefile: the word-list parsing and DAWG build now live in the separate
  scrabble-dictionary repository, which publishes the DAWG set as a release artifact.
- internal/dict loads the committed dawg/en_sowpods.dawg fixture for cmd/stress.
- Update README/CLAUDE docs accordingly.
2026-06-04 19:11:46 +02:00

38 lines
881 B
Go

package wordlist
import (
"testing"
"github.com/iliadenisov/alphabet"
)
func TestFoldYo(t *testing.T) {
if got := FoldYo("ёлка"); got != "елка" {
t.Errorf("FoldYo(ёлка) = %q, want елка", got)
}
if got := FoldYo("Ёжик"); got != "Ежик" {
t.Errorf("FoldYo(Ёжик) = %q, want Ежик", got)
}
}
func TestEncodeFilterSortDedupe(t *testing.T) {
got := Encode([]string{
"cat", "CATS", "ab", "b", "abcdefghi", "cat", " do ", "qu1rk",
}, alphabet.Latin(), 2, 8)
want := [][]byte{
{0, 1}, // ab
{2, 0, 19}, // cat
{2, 0, 19, 18}, // cats (from CATS, case-folded)
{3, 14}, // do (trimmed)
}
if len(got) != len(want) {
t.Fatalf("got %d words %v, want %d", len(got), got, len(want))
}
for i := range want {
if string(got[i]) != string(want[i]) {
t.Errorf("word %d = %v, want %v", i, got[i], want[i])
}
}
}