diff --git a/spelling_test.go b/spelling_test.go index 82fe73f..a417565 100644 --- a/spelling_test.go +++ b/spelling_test.go @@ -110,3 +110,52 @@ func TestSpell(t *testing.T) { }) } } + +func TestPronounce(t *testing.T) { + tests := []struct { + name string + syllables []string + want string + wantErr bool + }{ + { + name: "Pronounce_NoSyllables", + syllables: []string{}, + want: "", + wantErr: false, + }, + { + name: "Pronounce_SingleSyllable", + syllables: []string{"me"}, + want: "me", + wantErr: false, + }, + { + name: "Pronounce_MultipleSyllables", + syllables: []string{"mu", "sa"}, + want: "mu-sa", + wantErr: false, + }, + { + name: "Pronounce_NonKoremutakeSyllable", + syllables: []string{"รค"}, + wantErr: true, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + config := NewConfig() + g := New(config) + g.syllables = tt.syllables + got, err := g.Pronounce() + if (err != nil) != tt.wantErr { + t.Errorf("Generator.Pronounce() error = %v, wantErr %v", err, tt.wantErr) + return + } + if got != tt.want { + t.Errorf("Generator.Pronounce() = %v, want %v", got, tt.want) + } + }) + } +}