36 lines
688 B
Go
36 lines
688 B
Go
|
package iso639
|
||
|
|
||
|
import (
|
||
|
"testing"
|
||
|
)
|
||
|
|
||
|
func TestGetISO639_2BCodeForLanguageName(t *testing.T) {
|
||
|
data := map[string]string{
|
||
|
"Azerbaijani": "aze",
|
||
|
"Hindi": "hin",
|
||
|
"Norwegian Bokmål": "nob",
|
||
|
}
|
||
|
|
||
|
for code, name := range data {
|
||
|
result, _ := GetISO639_2BCodeForLanguageName(code)
|
||
|
if result != name {
|
||
|
t.Errorf("got %q, wanted %q", result, name)
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
func TestGetLanguageNameForISO639_2BCode(t *testing.T) {
|
||
|
data := map[string]string{
|
||
|
"che": "Chechen",
|
||
|
"gle": "Irish",
|
||
|
"mao": "Maori",
|
||
|
}
|
||
|
|
||
|
for code, name := range data {
|
||
|
result, _ := GetLanguageNameForISO639_2BCode(code)
|
||
|
if result != name {
|
||
|
t.Errorf("got %q, wanted %q", result, name)
|
||
|
}
|
||
|
}
|
||
|
}
|