-
Notifications
You must be signed in to change notification settings - Fork 6
/
mobilephone_misc_test.go
212 lines (209 loc) · 12.8 KB
/
mobilephone_misc_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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
/* This file is auto-generated! Any changes to this file will be lost! */
package woothee
import (
"testing"
)
func Test_mobilephone_misc(t *testing.T) {
var result *Result
var err error
result, err = Parse(`Mozilla/5.0 (jig browser core; SH03B)`)
if err != nil {
t.Errorf(`Failed to parse 'Mozilla/5.0 (jig browser core; SH03B)': %s`, err)
} else {
if result.Category != "mobilephone" {
t.Errorf("Expected result.Category for '%s' to be 'mobilephone', but got '%s'", `Mozilla/5.0 (jig browser core; SH03B)`, result.Category)
}
if result.Name != "jig browser" {
t.Errorf("Expected result.Name for '%s' to be 'jig browser', but got '%s'", `Mozilla/5.0 (jig browser core; SH03B)`, result.Name)
}
if true && result.Os != "jig" {
t.Errorf("Expected result.Os for '%s' to be 'jig', but got '%s'", `Mozilla/5.0 (jig browser core; SH03B)`, result.Os)
}
if false && result.OsVersion != "UNKNOWN" {
t.Errorf("Expected result.OsVersion for '%s' to be 'UNKNOWN', but got '%s'", `Mozilla/5.0 (jig browser core; SH03B)`, result.OsVersion)
}
if true && result.Version != "SH03B" {
t.Errorf("Expected result.Version for '%s' to be 'SH03B', but got '%s'", `Mozilla/5.0 (jig browser core; SH03B)`, result.Version)
}
}
result, err = Parse(`Mozilla/4.0 (jig browser9i 1.5.0; F10B; 2004)`)
if err != nil {
t.Errorf(`Failed to parse 'Mozilla/4.0 (jig browser9i 1.5.0; F10B; 2004)': %s`, err)
} else {
if result.Category != "mobilephone" {
t.Errorf("Expected result.Category for '%s' to be 'mobilephone', but got '%s'", `Mozilla/4.0 (jig browser9i 1.5.0; F10B; 2004)`, result.Category)
}
if result.Name != "jig browser" {
t.Errorf("Expected result.Name for '%s' to be 'jig browser', but got '%s'", `Mozilla/4.0 (jig browser9i 1.5.0; F10B; 2004)`, result.Name)
}
if true && result.Os != "jig" {
t.Errorf("Expected result.Os for '%s' to be 'jig', but got '%s'", `Mozilla/4.0 (jig browser9i 1.5.0; F10B; 2004)`, result.Os)
}
if false && result.OsVersion != "UNKNOWN" {
t.Errorf("Expected result.OsVersion for '%s' to be 'UNKNOWN', but got '%s'", `Mozilla/4.0 (jig browser9i 1.5.0; F10B; 2004)`, result.OsVersion)
}
if true && result.Version != "F10B" {
t.Errorf("Expected result.Version for '%s' to be 'F10B', but got '%s'", `Mozilla/4.0 (jig browser9i 1.5.0; F10B; 2004)`, result.Version)
}
}
result, err = Parse(`Mozilla/4.0 (jig browser9)`)
if err != nil {
t.Errorf(`Failed to parse 'Mozilla/4.0 (jig browser9)': %s`, err)
} else {
if result.Category != "mobilephone" {
t.Errorf("Expected result.Category for '%s' to be 'mobilephone', but got '%s'", `Mozilla/4.0 (jig browser9)`, result.Category)
}
if result.Name != "jig browser" {
t.Errorf("Expected result.Name for '%s' to be 'jig browser', but got '%s'", `Mozilla/4.0 (jig browser9)`, result.Name)
}
if true && result.Os != "jig" {
t.Errorf("Expected result.Os for '%s' to be 'jig', but got '%s'", `Mozilla/4.0 (jig browser9)`, result.Os)
}
if false && result.OsVersion != "UNKNOWN" {
t.Errorf("Expected result.OsVersion for '%s' to be 'UNKNOWN', but got '%s'", `Mozilla/4.0 (jig browser9)`, result.OsVersion)
}
if true && result.Version != "UNKNOWN" {
t.Errorf("Expected result.Version for '%s' to be 'UNKNOWN', but got '%s'", `Mozilla/4.0 (jig browser9)`, result.Version)
}
}
result, err = Parse(`emobile/1.0.0 (H11T; like Gecko; Wireless) NetFront/3.4`)
if err != nil {
t.Errorf(`Failed to parse 'emobile/1.0.0 (H11T; like Gecko; Wireless) NetFront/3.4': %s`, err)
} else {
if result.Category != "mobilephone" {
t.Errorf("Expected result.Category for '%s' to be 'mobilephone', but got '%s'", `emobile/1.0.0 (H11T; like Gecko; Wireless) NetFront/3.4`, result.Category)
}
if result.Name != "emobile" {
t.Errorf("Expected result.Name for '%s' to be 'emobile', but got '%s'", `emobile/1.0.0 (H11T; like Gecko; Wireless) NetFront/3.4`, result.Name)
}
if true && result.Os != "emobile" {
t.Errorf("Expected result.Os for '%s' to be 'emobile', but got '%s'", `emobile/1.0.0 (H11T; like Gecko; Wireless) NetFront/3.4`, result.Os)
}
if false && result.OsVersion != "UNKNOWN" {
t.Errorf("Expected result.OsVersion for '%s' to be 'UNKNOWN', but got '%s'", `emobile/1.0.0 (H11T; like Gecko; Wireless) NetFront/3.4`, result.OsVersion)
}
if false && result.Version != "UNKNOWN" {
t.Errorf("Expected result.Version for '%s' to be 'UNKNOWN', but got '%s'", `emobile/1.0.0 (H11T; like Gecko; Wireless) NetFront/3.4`, result.Version)
}
}
result, err = Parse(`IAC/1.0 (H31IA;like Gecko;OpenBrowser) WWW Browser/ver1.0`)
if err != nil {
t.Errorf(`Failed to parse 'IAC/1.0 (H31IA;like Gecko;OpenBrowser) WWW Browser/ver1.0': %s`, err)
} else {
if result.Category != "mobilephone" {
t.Errorf("Expected result.Category for '%s' to be 'mobilephone', but got '%s'", `IAC/1.0 (H31IA;like Gecko;OpenBrowser) WWW Browser/ver1.0`, result.Category)
}
if result.Name != "emobile" {
t.Errorf("Expected result.Name for '%s' to be 'emobile', but got '%s'", `IAC/1.0 (H31IA;like Gecko;OpenBrowser) WWW Browser/ver1.0`, result.Name)
}
if true && result.Os != "emobile" {
t.Errorf("Expected result.Os for '%s' to be 'emobile', but got '%s'", `IAC/1.0 (H31IA;like Gecko;OpenBrowser) WWW Browser/ver1.0`, result.Os)
}
if false && result.OsVersion != "UNKNOWN" {
t.Errorf("Expected result.OsVersion for '%s' to be 'UNKNOWN', but got '%s'", `IAC/1.0 (H31IA;like Gecko;OpenBrowser) WWW Browser/ver1.0`, result.OsVersion)
}
if false && result.Version != "UNKNOWN" {
t.Errorf("Expected result.Version for '%s' to be 'UNKNOWN', but got '%s'", `IAC/1.0 (H31IA;like Gecko;OpenBrowser) WWW Browser/ver1.0`, result.Version)
}
}
result, err = Parse(`Mozilla/5.0 (H11T; like Gecko; OpenBrowser) NetFront/3.4`)
if err != nil {
t.Errorf(`Failed to parse 'Mozilla/5.0 (H11T; like Gecko; OpenBrowser) NetFront/3.4': %s`, err)
} else {
if result.Category != "mobilephone" {
t.Errorf("Expected result.Category for '%s' to be 'mobilephone', but got '%s'", `Mozilla/5.0 (H11T; like Gecko; OpenBrowser) NetFront/3.4`, result.Category)
}
if result.Name != "emobile" {
t.Errorf("Expected result.Name for '%s' to be 'emobile', but got '%s'", `Mozilla/5.0 (H11T; like Gecko; OpenBrowser) NetFront/3.4`, result.Name)
}
if true && result.Os != "emobile" {
t.Errorf("Expected result.Os for '%s' to be 'emobile', but got '%s'", `Mozilla/5.0 (H11T; like Gecko; OpenBrowser) NetFront/3.4`, result.Os)
}
if false && result.OsVersion != "UNKNOWN" {
t.Errorf("Expected result.OsVersion for '%s' to be 'UNKNOWN', but got '%s'", `Mozilla/5.0 (H11T; like Gecko; OpenBrowser) NetFront/3.4`, result.OsVersion)
}
if false && result.Version != "UNKNOWN" {
t.Errorf("Expected result.Version for '%s' to be 'UNKNOWN', but got '%s'", `Mozilla/5.0 (H11T; like Gecko; OpenBrowser) NetFront/3.4`, result.Version)
}
}
result, err = Parse(`Huawei/1.0/H12HW/B000 Browser/Obigo-Browser/Q04A`)
if err != nil {
t.Errorf(`Failed to parse 'Huawei/1.0/H12HW/B000 Browser/Obigo-Browser/Q04A': %s`, err)
} else {
if result.Category != "mobilephone" {
t.Errorf("Expected result.Category for '%s' to be 'mobilephone', but got '%s'", `Huawei/1.0/H12HW/B000 Browser/Obigo-Browser/Q04A`, result.Category)
}
if result.Name != "emobile" {
t.Errorf("Expected result.Name for '%s' to be 'emobile', but got '%s'", `Huawei/1.0/H12HW/B000 Browser/Obigo-Browser/Q04A`, result.Name)
}
if true && result.Os != "emobile" {
t.Errorf("Expected result.Os for '%s' to be 'emobile', but got '%s'", `Huawei/1.0/H12HW/B000 Browser/Obigo-Browser/Q04A`, result.Os)
}
if false && result.OsVersion != "UNKNOWN" {
t.Errorf("Expected result.OsVersion for '%s' to be 'UNKNOWN', but got '%s'", `Huawei/1.0/H12HW/B000 Browser/Obigo-Browser/Q04A`, result.OsVersion)
}
if false && result.Version != "UNKNOWN" {
t.Errorf("Expected result.Version for '%s' to be 'UNKNOWN', but got '%s'", `Huawei/1.0/H12HW/B000 Browser/Obigo-Browser/Q04A`, result.Version)
}
}
result, err = Parse(`Mozilla/5.0 (SymbianOS/9.2; U; Series60/3.1 NokiaE66-1/500.21.009; Profile/MIDP-2.0 Configuration/CLDC-1.1 ) AppleWebKit/413 (KHTML, like Gecko) Safari/413`)
if err != nil {
t.Errorf(`Failed to parse 'Mozilla/5.0 (SymbianOS/9.2; U; Series60/3.1 NokiaE66-1/500.21.009; Profile/MIDP-2.0 Configuration/CLDC-1.1 ) AppleWebKit/413 (KHTML, like Gecko) Safari/413': %s`, err)
} else {
if result.Category != "mobilephone" {
t.Errorf("Expected result.Category for '%s' to be 'mobilephone', but got '%s'", `Mozilla/5.0 (SymbianOS/9.2; U; Series60/3.1 NokiaE66-1/500.21.009; Profile/MIDP-2.0 Configuration/CLDC-1.1 ) AppleWebKit/413 (KHTML, like Gecko) Safari/413`, result.Category)
}
if result.Name != "Safari" {
t.Errorf("Expected result.Name for '%s' to be 'Safari', but got '%s'", `Mozilla/5.0 (SymbianOS/9.2; U; Series60/3.1 NokiaE66-1/500.21.009; Profile/MIDP-2.0 Configuration/CLDC-1.1 ) AppleWebKit/413 (KHTML, like Gecko) Safari/413`, result.Name)
}
if true && result.Os != "SymbianOS" {
t.Errorf("Expected result.Os for '%s' to be 'SymbianOS', but got '%s'", `Mozilla/5.0 (SymbianOS/9.2; U; Series60/3.1 NokiaE66-1/500.21.009; Profile/MIDP-2.0 Configuration/CLDC-1.1 ) AppleWebKit/413 (KHTML, like Gecko) Safari/413`, result.Os)
}
if false && result.OsVersion != "UNKNOWN" {
t.Errorf("Expected result.OsVersion for '%s' to be 'UNKNOWN', but got '%s'", `Mozilla/5.0 (SymbianOS/9.2; U; Series60/3.1 NokiaE66-1/500.21.009; Profile/MIDP-2.0 Configuration/CLDC-1.1 ) AppleWebKit/413 (KHTML, like Gecko) Safari/413`, result.OsVersion)
}
if true && result.Version != "UNKNOWN" {
t.Errorf("Expected result.Version for '%s' to be 'UNKNOWN', but got '%s'", `Mozilla/5.0 (SymbianOS/9.2; U; Series60/3.1 NokiaE66-1/500.21.009; Profile/MIDP-2.0 Configuration/CLDC-1.1 ) AppleWebKit/413 (KHTML, like Gecko) Safari/413`, result.Version)
}
}
result, err = Parse(`Mozilla/5.0 (en-us) AppleWebKit/534.14 (KHTML, like Gecko; Google Wireless Transcoder) Chrome/9.0.597 Safari/534.14`)
if err != nil {
t.Errorf(`Failed to parse 'Mozilla/5.0 (en-us) AppleWebKit/534.14 (KHTML, like Gecko; Google Wireless Transcoder) Chrome/9.0.597 Safari/534.14': %s`, err)
} else {
if result.Category != "mobilephone" {
t.Errorf("Expected result.Category for '%s' to be 'mobilephone', but got '%s'", `Mozilla/5.0 (en-us) AppleWebKit/534.14 (KHTML, like Gecko; Google Wireless Transcoder) Chrome/9.0.597 Safari/534.14`, result.Category)
}
if result.Name != "Mobile Transcoder" {
t.Errorf("Expected result.Name for '%s' to be 'Mobile Transcoder', but got '%s'", `Mozilla/5.0 (en-us) AppleWebKit/534.14 (KHTML, like Gecko; Google Wireless Transcoder) Chrome/9.0.597 Safari/534.14`, result.Name)
}
if true && result.Os != "Mobile Transcoder" {
t.Errorf("Expected result.Os for '%s' to be 'Mobile Transcoder', but got '%s'", `Mozilla/5.0 (en-us) AppleWebKit/534.14 (KHTML, like Gecko; Google Wireless Transcoder) Chrome/9.0.597 Safari/534.14`, result.Os)
}
if false && result.OsVersion != "UNKNOWN" {
t.Errorf("Expected result.OsVersion for '%s' to be 'UNKNOWN', but got '%s'", `Mozilla/5.0 (en-us) AppleWebKit/534.14 (KHTML, like Gecko; Google Wireless Transcoder) Chrome/9.0.597 Safari/534.14`, result.OsVersion)
}
if true && result.Version != "Google" {
t.Errorf("Expected result.Version for '%s' to be 'Google', but got '%s'", `Mozilla/5.0 (en-us) AppleWebKit/534.14 (KHTML, like Gecko; Google Wireless Transcoder) Chrome/9.0.597 Safari/534.14`, result.Version)
}
}
result, err = Parse(`Mozilla/5.0 (compatible; livedoor-Mobile-Gateway/0.02; +http://p.m.livedoor.com/help.html)`)
if err != nil {
t.Errorf(`Failed to parse 'Mozilla/5.0 (compatible; livedoor-Mobile-Gateway/0.02; +http://p.m.livedoor.com/help.html)': %s`, err)
} else {
if result.Category != "mobilephone" {
t.Errorf("Expected result.Category for '%s' to be 'mobilephone', but got '%s'", `Mozilla/5.0 (compatible; livedoor-Mobile-Gateway/0.02; +http://p.m.livedoor.com/help.html)`, result.Category)
}
if result.Name != "Mobile Transcoder" {
t.Errorf("Expected result.Name for '%s' to be 'Mobile Transcoder', but got '%s'", `Mozilla/5.0 (compatible; livedoor-Mobile-Gateway/0.02; +http://p.m.livedoor.com/help.html)`, result.Name)
}
if true && result.Os != "Mobile Transcoder" {
t.Errorf("Expected result.Os for '%s' to be 'Mobile Transcoder', but got '%s'", `Mozilla/5.0 (compatible; livedoor-Mobile-Gateway/0.02; +http://p.m.livedoor.com/help.html)`, result.Os)
}
if false && result.OsVersion != "UNKNOWN" {
t.Errorf("Expected result.OsVersion for '%s' to be 'UNKNOWN', but got '%s'", `Mozilla/5.0 (compatible; livedoor-Mobile-Gateway/0.02; +http://p.m.livedoor.com/help.html)`, result.OsVersion)
}
if true && result.Version != "livedoor" {
t.Errorf("Expected result.Version for '%s' to be 'livedoor', but got '%s'", `Mozilla/5.0 (compatible; livedoor-Mobile-Gateway/0.02; +http://p.m.livedoor.com/help.html)`, result.Version)
}
}
}