croatian_test.go raw
1 package shadow
2
3 import "testing"
4
5 func TestFromCroatian(t *testing.T) {
6 tests := []struct {
7 name string
8 in string
9 want string
10 }{
11 {"simple vowels", "aeiou", "AEIOU"},
12 {"basic word", "pas", "PAS"},
13 {"č", "čovjek", "ЧOVYEK"},
14 {"š", "šuma", "ΣUMA"},
15 {"ž", "život", "Ζ̌IVOT"},
16 {"ć", "ćevap", "ЧEVAP"},
17 {"đ", "đak", "ЏAK"},
18 {"j maps to Y", "ja", "YA"},
19 {"digraph dž", "džep", "ЏEP"},
20 {"digraph lj", "ljubav", "LYUBAV"},
21 {"digraph nj", "njega", "NYEGA"},
22 {"c as TS", "car", "TSAR"},
23 {"mixed case", "Zagreb", "ZAGREB"},
24 {"digits passthrough", "2025", "2025"},
25 {"spaces", "dobar dan", "DOBAR DAN"},
26 {"full sentence", "Što je novo?", "ΣTO YE NOVO?"},
27 {"prst (syllabic r)", "prst", "PRST"},
28 {"krk", "Krk", "KRK"},
29 }
30
31 for _, tt := range tests {
32 t.Run(tt.name, func(t *testing.T) {
33 got := FromCroatian(tt.in)
34 if got != tt.want {
35 t.Errorf("FromCroatian(%q) = %q, want %q", tt.in, got, tt.want)
36 }
37 })
38 }
39 }
40