forked from klauspost/cld2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlanguages_test.go
42 lines (34 loc) · 917 Bytes
/
languages_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
package cld2
import "testing"
func TestLanguageFromCode(t *testing.T) {
l := LanguageFromCode("da")
if l != DANISH {
t.Errorf("want 'da' code to return Danish, got %s", l.String())
}
l = LanguageFromCode("something")
if l != UNKNOWN_LANGUAGE {
t.Errorf("want 'something' code to return Unknown Language, got %s", l.String())
}
l = LanguageFromCode("un")
if l != UNKNOWN_LANGUAGE {
t.Errorf("want 'something' code to return Unknown Language, got %s", l.String())
}
}
func TestLanguageFromID(t *testing.T) {
l := NewLanguage(uint16(THAI))
if l != THAI {
t.Errorf("want Thai, got %v", l)
}
l = NewLanguage(65000)
if l != UNKNOWN_LANGUAGE {
t.Errorf("want Unknown Language, got %v", l)
}
l = NewLanguage(0)
if l != ENGLISH {
t.Errorf("want English, got %v", l)
}
l = NewLanguage(uint16(NUM_LANGUAGES))
if l != UNKNOWN_LANGUAGE {
t.Errorf("want Unknown Language, got %v", l)
}
}