-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathpc_misc_test.go
More file actions
412 lines (409 loc) · 29.4 KB
/
pc_misc_test.go
File metadata and controls
412 lines (409 loc) · 29.4 KB
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
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
/* This file is auto-generated! Any changes to this file will be lost! */
package woothee
import (
"testing"
)
func Test_pc_misc(t *testing.T) {
var result *Result
var err error
result, err = Parse(`Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_4; ja-jp) AppleWebKit/525.18 (KHTML, like Gecko) Version/3.1.2 Safari/525.20.1`)
if err != nil {
t.Errorf(`Failed to parse 'Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_4; ja-jp) AppleWebKit/525.18 (KHTML, like Gecko) Version/3.1.2 Safari/525.20.1': %s`, err)
} else {
if result.Category != "pc" {
t.Errorf("Expected result.Category for '%s' to be 'pc', but got '%s'", `Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_4; ja-jp) AppleWebKit/525.18 (KHTML, like Gecko) Version/3.1.2 Safari/525.20.1`, result.Category)
}
if result.Name != "Safari" {
t.Errorf("Expected result.Name for '%s' to be 'Safari', but got '%s'", `Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_4; ja-jp) AppleWebKit/525.18 (KHTML, like Gecko) Version/3.1.2 Safari/525.20.1`, result.Name)
}
if true && result.Os != "Mac OSX" {
t.Errorf("Expected result.Os for '%s' to be 'Mac OSX', but got '%s'", `Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_4; ja-jp) AppleWebKit/525.18 (KHTML, like Gecko) Version/3.1.2 Safari/525.20.1`, result.Os)
}
if true && result.OsVersion != "10.5.4" {
t.Errorf("Expected result.OsVersion for '%s' to be '10.5.4', but got '%s'", `Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_4; ja-jp) AppleWebKit/525.18 (KHTML, like Gecko) Version/3.1.2 Safari/525.20.1`, result.OsVersion)
}
if true && result.Version != "3.1.2" {
t.Errorf("Expected result.Version for '%s' to be '3.1.2', but got '%s'", `Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_4; ja-jp) AppleWebKit/525.18 (KHTML, like Gecko) Version/3.1.2 Safari/525.20.1`, result.Version)
}
}
result, err = Parse(`Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/27.0.1453.93 Safari/537.36`)
if err != nil {
t.Errorf(`Failed to parse 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/27.0.1453.93 Safari/537.36': %s`, err)
} else {
if result.Category != "pc" {
t.Errorf("Expected result.Category for '%s' to be 'pc', but got '%s'", `Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/27.0.1453.93 Safari/537.36`, result.Category)
}
if result.Name != "Chrome" {
t.Errorf("Expected result.Name for '%s' to be 'Chrome', but got '%s'", `Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/27.0.1453.93 Safari/537.36`, result.Name)
}
if true && result.Os != "Mac OSX" {
t.Errorf("Expected result.Os for '%s' to be 'Mac OSX', but got '%s'", `Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/27.0.1453.93 Safari/537.36`, result.Os)
}
if true && result.OsVersion != "10.7.5" {
t.Errorf("Expected result.OsVersion for '%s' to be '10.7.5', but got '%s'", `Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/27.0.1453.93 Safari/537.36`, result.OsVersion)
}
if true && result.Version != "27.0.1453.93" {
t.Errorf("Expected result.Version for '%s' to be '27.0.1453.93', but got '%s'", `Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/27.0.1453.93 Safari/537.36`, result.Version)
}
}
result, err = Parse(`Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:21.0) Gecko/20100101 Firefox/21.0`)
if err != nil {
t.Errorf(`Failed to parse 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:21.0) Gecko/20100101 Firefox/21.0': %s`, err)
} else {
if result.Category != "pc" {
t.Errorf("Expected result.Category for '%s' to be 'pc', but got '%s'", `Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:21.0) Gecko/20100101 Firefox/21.0`, result.Category)
}
if result.Name != "Firefox" {
t.Errorf("Expected result.Name for '%s' to be 'Firefox', but got '%s'", `Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:21.0) Gecko/20100101 Firefox/21.0`, result.Name)
}
if true && result.Os != "Mac OSX" {
t.Errorf("Expected result.Os for '%s' to be 'Mac OSX', but got '%s'", `Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:21.0) Gecko/20100101 Firefox/21.0`, result.Os)
}
if true && result.OsVersion != "10.7" {
t.Errorf("Expected result.OsVersion for '%s' to be '10.7', but got '%s'", `Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:21.0) Gecko/20100101 Firefox/21.0`, result.OsVersion)
}
if true && result.Version != "21.0" {
t.Errorf("Expected result.Version for '%s' to be '21.0', but got '%s'", `Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:21.0) Gecko/20100101 Firefox/21.0`, result.Version)
}
}
result, err = Parse(`Opera/9.80 (Macintosh; Intel Mac OS X 10.8.3) Presto/2.12.388 Version/12.15`)
if err != nil {
t.Errorf(`Failed to parse 'Opera/9.80 (Macintosh; Intel Mac OS X 10.8.3) Presto/2.12.388 Version/12.15': %s`, err)
} else {
if result.Category != "pc" {
t.Errorf("Expected result.Category for '%s' to be 'pc', but got '%s'", `Opera/9.80 (Macintosh; Intel Mac OS X 10.8.3) Presto/2.12.388 Version/12.15`, result.Category)
}
if result.Name != "Opera" {
t.Errorf("Expected result.Name for '%s' to be 'Opera', but got '%s'", `Opera/9.80 (Macintosh; Intel Mac OS X 10.8.3) Presto/2.12.388 Version/12.15`, result.Name)
}
if true && result.Os != "Mac OSX" {
t.Errorf("Expected result.Os for '%s' to be 'Mac OSX', but got '%s'", `Opera/9.80 (Macintosh; Intel Mac OS X 10.8.3) Presto/2.12.388 Version/12.15`, result.Os)
}
if true && result.OsVersion != "10.8.3" {
t.Errorf("Expected result.OsVersion for '%s' to be '10.8.3', but got '%s'", `Opera/9.80 (Macintosh; Intel Mac OS X 10.8.3) Presto/2.12.388 Version/12.15`, result.OsVersion)
}
if true && result.Version != "12.15" {
t.Errorf("Expected result.Version for '%s' to be '12.15', but got '%s'", `Opera/9.80 (Macintosh; Intel Mac OS X 10.8.3) Presto/2.12.388 Version/12.15`, result.Version)
}
}
result, err = Parse(`Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/33.0.1750.154 Safari/537.36 OPR/20.0.1387.82`)
if err != nil {
t.Errorf(`Failed to parse 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/33.0.1750.154 Safari/537.36 OPR/20.0.1387.82': %s`, err)
} else {
if result.Category != "pc" {
t.Errorf("Expected result.Category for '%s' to be 'pc', but got '%s'", `Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/33.0.1750.154 Safari/537.36 OPR/20.0.1387.82`, result.Category)
}
if result.Name != "Opera" {
t.Errorf("Expected result.Name for '%s' to be 'Opera', but got '%s'", `Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/33.0.1750.154 Safari/537.36 OPR/20.0.1387.82`, result.Name)
}
if true && result.Os != "Mac OSX" {
t.Errorf("Expected result.Os for '%s' to be 'Mac OSX', but got '%s'", `Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/33.0.1750.154 Safari/537.36 OPR/20.0.1387.82`, result.Os)
}
if true && result.OsVersion != "10.9.2" {
t.Errorf("Expected result.OsVersion for '%s' to be '10.9.2', but got '%s'", `Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/33.0.1750.154 Safari/537.36 OPR/20.0.1387.82`, result.OsVersion)
}
if true && result.Version != "20.0.1387.82" {
t.Errorf("Expected result.Version for '%s' to be '20.0.1387.82', but got '%s'", `Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/33.0.1750.154 Safari/537.36 OPR/20.0.1387.82`, result.Version)
}
}
result, err = Parse(`Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.94 Safari/537.36 Vivaldi/1.1.453.52`)
if err != nil {
t.Errorf(`Failed to parse 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.94 Safari/537.36 Vivaldi/1.1.453.52': %s`, err)
} else {
if result.Category != "pc" {
t.Errorf("Expected result.Category for '%s' to be 'pc', but got '%s'", `Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.94 Safari/537.36 Vivaldi/1.1.453.52`, result.Category)
}
if result.Name != "Vivaldi" {
t.Errorf("Expected result.Name for '%s' to be 'Vivaldi', but got '%s'", `Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.94 Safari/537.36 Vivaldi/1.1.453.52`, result.Name)
}
if true && result.Os != "Mac OSX" {
t.Errorf("Expected result.Os for '%s' to be 'Mac OSX', but got '%s'", `Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.94 Safari/537.36 Vivaldi/1.1.453.52`, result.Os)
}
if true && result.OsVersion != "10.11.4" {
t.Errorf("Expected result.OsVersion for '%s' to be '10.11.4', but got '%s'", `Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.94 Safari/537.36 Vivaldi/1.1.453.52`, result.OsVersion)
}
if true && result.Version != "1.1.453.52" {
t.Errorf("Expected result.Version for '%s' to be '1.1.453.52', but got '%s'", `Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.94 Safari/537.36 Vivaldi/1.1.453.52`, result.Version)
}
}
result, err = Parse(`Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_8) AppleWebKit/534.50 (KHTML, like Gecko) Version/5.1 Instapaper/4.0 (+http://www.instapaper.com/)`)
if err != nil {
t.Errorf(`Failed to parse 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_8) AppleWebKit/534.50 (KHTML, like Gecko) Version/5.1 Instapaper/4.0 (+http://www.instapaper.com/)': %s`, err)
} else {
if result.Category != "pc" {
t.Errorf("Expected result.Category for '%s' to be 'pc', but got '%s'", `Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_8) AppleWebKit/534.50 (KHTML, like Gecko) Version/5.1 Instapaper/4.0 (+http://www.instapaper.com/)`, result.Category)
}
if result.Name != "UNKNOWN" {
t.Errorf("Expected result.Name for '%s' to be 'UNKNOWN', but got '%s'", `Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_8) AppleWebKit/534.50 (KHTML, like Gecko) Version/5.1 Instapaper/4.0 (+http://www.instapaper.com/)`, result.Name)
}
if true && result.Os != "Mac OSX" {
t.Errorf("Expected result.Os for '%s' to be 'Mac OSX', but got '%s'", `Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_8) AppleWebKit/534.50 (KHTML, like Gecko) Version/5.1 Instapaper/4.0 (+http://www.instapaper.com/)`, result.Os)
}
if false && result.OsVersion != "UNKNOWN" {
t.Errorf("Expected result.OsVersion for '%s' to be 'UNKNOWN', but got '%s'", `Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_8) AppleWebKit/534.50 (KHTML, like Gecko) Version/5.1 Instapaper/4.0 (+http://www.instapaper.com/)`, result.OsVersion)
}
if false && result.Version != "UNKNOWN" {
t.Errorf("Expected result.Version for '%s' to be 'UNKNOWN', but got '%s'", `Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_8) AppleWebKit/534.50 (KHTML, like Gecko) Version/5.1 Instapaper/4.0 (+http://www.instapaper.com/)`, result.Version)
}
}
result, err = Parse(`Mozilla/5.0 (Macintosh; U; PPC Mac OS X 10.5; ja-JP-mac; rv:1.9.1.19) Gecko/20110420 SeaMonkey/2.0.14`)
if err != nil {
t.Errorf(`Failed to parse 'Mozilla/5.0 (Macintosh; U; PPC Mac OS X 10.5; ja-JP-mac; rv:1.9.1.19) Gecko/20110420 SeaMonkey/2.0.14': %s`, err)
} else {
if result.Category != "pc" {
t.Errorf("Expected result.Category for '%s' to be 'pc', but got '%s'", `Mozilla/5.0 (Macintosh; U; PPC Mac OS X 10.5; ja-JP-mac; rv:1.9.1.19) Gecko/20110420 SeaMonkey/2.0.14`, result.Category)
}
if result.Name != "UNKNOWN" {
t.Errorf("Expected result.Name for '%s' to be 'UNKNOWN', but got '%s'", `Mozilla/5.0 (Macintosh; U; PPC Mac OS X 10.5; ja-JP-mac; rv:1.9.1.19) Gecko/20110420 SeaMonkey/2.0.14`, result.Name)
}
if true && result.Os != "Mac OSX" {
t.Errorf("Expected result.Os for '%s' to be 'Mac OSX', but got '%s'", `Mozilla/5.0 (Macintosh; U; PPC Mac OS X 10.5; ja-JP-mac; rv:1.9.1.19) Gecko/20110420 SeaMonkey/2.0.14`, result.Os)
}
if true && result.OsVersion != "10.5" {
t.Errorf("Expected result.OsVersion for '%s' to be '10.5', but got '%s'", `Mozilla/5.0 (Macintosh; U; PPC Mac OS X 10.5; ja-JP-mac; rv:1.9.1.19) Gecko/20110420 SeaMonkey/2.0.14`, result.OsVersion)
}
if false && result.Version != "UNKNOWN" {
t.Errorf("Expected result.Version for '%s' to be 'UNKNOWN', but got '%s'", `Mozilla/5.0 (Macintosh; U; PPC Mac OS X 10.5; ja-JP-mac; rv:1.9.1.19) Gecko/20110420 SeaMonkey/2.0.14`, result.Version)
}
}
result, err = Parse(`Mozilla/5.0 (Macintosh; U; PPC; en-US; mimic; rv:9.2.1) (mimic Gecko/20100722 Firefox/3.6.8) Classilla/CFM`)
if err != nil {
t.Errorf(`Failed to parse 'Mozilla/5.0 (Macintosh; U; PPC; en-US; mimic; rv:9.2.1) (mimic Gecko/20100722 Firefox/3.6.8) Classilla/CFM': %s`, err)
} else {
if result.Category != "pc" {
t.Errorf("Expected result.Category for '%s' to be 'pc', but got '%s'", `Mozilla/5.0 (Macintosh; U; PPC; en-US; mimic; rv:9.2.1) (mimic Gecko/20100722 Firefox/3.6.8) Classilla/CFM`, result.Category)
}
if result.Name != "Firefox" {
t.Errorf("Expected result.Name for '%s' to be 'Firefox', but got '%s'", `Mozilla/5.0 (Macintosh; U; PPC; en-US; mimic; rv:9.2.1) (mimic Gecko/20100722 Firefox/3.6.8) Classilla/CFM`, result.Name)
}
if true && result.Os != "Mac OS Classic" {
t.Errorf("Expected result.Os for '%s' to be 'Mac OS Classic', but got '%s'", `Mozilla/5.0 (Macintosh; U; PPC; en-US; mimic; rv:9.2.1) (mimic Gecko/20100722 Firefox/3.6.8) Classilla/CFM`, result.Os)
}
if true && result.OsVersion != "9.2.1" {
t.Errorf("Expected result.OsVersion for '%s' to be '9.2.1', but got '%s'", `Mozilla/5.0 (Macintosh; U; PPC; en-US; mimic; rv:9.2.1) (mimic Gecko/20100722 Firefox/3.6.8) Classilla/CFM`, result.OsVersion)
}
if true && result.Version != "3.6.8" {
t.Errorf("Expected result.Version for '%s' to be '3.6.8', but got '%s'", `Mozilla/5.0 (Macintosh; U; PPC; en-US; mimic; rv:9.2.1) (mimic Gecko/20100722 Firefox/3.6.8) Classilla/CFM`, result.Version)
}
}
result, err = Parse(`Mozilla/4.0 (compatible; MSIE 5.17; Mac_PowerPC)`)
if err != nil {
t.Errorf(`Failed to parse 'Mozilla/4.0 (compatible; MSIE 5.17; Mac_PowerPC)': %s`, err)
} else {
if result.Category != "pc" {
t.Errorf("Expected result.Category for '%s' to be 'pc', but got '%s'", `Mozilla/4.0 (compatible; MSIE 5.17; Mac_PowerPC)`, result.Category)
}
if result.Name != "Internet Explorer" {
t.Errorf("Expected result.Name for '%s' to be 'Internet Explorer', but got '%s'", `Mozilla/4.0 (compatible; MSIE 5.17; Mac_PowerPC)`, result.Name)
}
if true && result.Os != "Mac OS Classic" {
t.Errorf("Expected result.Os for '%s' to be 'Mac OS Classic', but got '%s'", `Mozilla/4.0 (compatible; MSIE 5.17; Mac_PowerPC)`, result.Os)
}
if false && result.OsVersion != "UNKNOWN" {
t.Errorf("Expected result.OsVersion for '%s' to be 'UNKNOWN', but got '%s'", `Mozilla/4.0 (compatible; MSIE 5.17; Mac_PowerPC)`, result.OsVersion)
}
if true && result.Version != "5.17" {
t.Errorf("Expected result.Version for '%s' to be '5.17', but got '%s'", `Mozilla/4.0 (compatible; MSIE 5.17; Mac_PowerPC)`, result.Version)
}
}
result, err = Parse(`Mozilla/5.0 (Ubuntu; X11; Linux i686; rv:9.0.1) Gecko/20100101 Firefox/9.0.1`)
if err != nil {
t.Errorf(`Failed to parse 'Mozilla/5.0 (Ubuntu; X11; Linux i686; rv:9.0.1) Gecko/20100101 Firefox/9.0.1': %s`, err)
} else {
if result.Category != "pc" {
t.Errorf("Expected result.Category for '%s' to be 'pc', but got '%s'", `Mozilla/5.0 (Ubuntu; X11; Linux i686; rv:9.0.1) Gecko/20100101 Firefox/9.0.1`, result.Category)
}
if result.Name != "Firefox" {
t.Errorf("Expected result.Name for '%s' to be 'Firefox', but got '%s'", `Mozilla/5.0 (Ubuntu; X11; Linux i686; rv:9.0.1) Gecko/20100101 Firefox/9.0.1`, result.Name)
}
if true && result.Os != "Linux" {
t.Errorf("Expected result.Os for '%s' to be 'Linux', but got '%s'", `Mozilla/5.0 (Ubuntu; X11; Linux i686; rv:9.0.1) Gecko/20100101 Firefox/9.0.1`, result.Os)
}
if false && result.OsVersion != "UNKNOWN" {
t.Errorf("Expected result.OsVersion for '%s' to be 'UNKNOWN', but got '%s'", `Mozilla/5.0 (Ubuntu; X11; Linux i686; rv:9.0.1) Gecko/20100101 Firefox/9.0.1`, result.OsVersion)
}
if true && result.Version != "9.0.1" {
t.Errorf("Expected result.Version for '%s' to be '9.0.1', but got '%s'", `Mozilla/5.0 (Ubuntu; X11; Linux i686; rv:9.0.1) Gecko/20100101 Firefox/9.0.1`, result.Version)
}
}
result, err = Parse(`Mozilla/5.0 (X11; Linux i686) AppleWebKit/535.7 (KHTML, like Gecko) Chrome/16.0.912.75 Safari/535.7`)
if err != nil {
t.Errorf(`Failed to parse 'Mozilla/5.0 (X11; Linux i686) AppleWebKit/535.7 (KHTML, like Gecko) Chrome/16.0.912.75 Safari/535.7': %s`, err)
} else {
if result.Category != "pc" {
t.Errorf("Expected result.Category for '%s' to be 'pc', but got '%s'", `Mozilla/5.0 (X11; Linux i686) AppleWebKit/535.7 (KHTML, like Gecko) Chrome/16.0.912.75 Safari/535.7`, result.Category)
}
if result.Name != "Chrome" {
t.Errorf("Expected result.Name for '%s' to be 'Chrome', but got '%s'", `Mozilla/5.0 (X11; Linux i686) AppleWebKit/535.7 (KHTML, like Gecko) Chrome/16.0.912.75 Safari/535.7`, result.Name)
}
if true && result.Os != "Linux" {
t.Errorf("Expected result.Os for '%s' to be 'Linux', but got '%s'", `Mozilla/5.0 (X11; Linux i686) AppleWebKit/535.7 (KHTML, like Gecko) Chrome/16.0.912.75 Safari/535.7`, result.Os)
}
if false && result.OsVersion != "UNKNOWN" {
t.Errorf("Expected result.OsVersion for '%s' to be 'UNKNOWN', but got '%s'", `Mozilla/5.0 (X11; Linux i686) AppleWebKit/535.7 (KHTML, like Gecko) Chrome/16.0.912.75 Safari/535.7`, result.OsVersion)
}
if true && result.Version != "16.0.912.75" {
t.Errorf("Expected result.Version for '%s' to be '16.0.912.75', but got '%s'", `Mozilla/5.0 (X11; Linux i686) AppleWebKit/535.7 (KHTML, like Gecko) Chrome/16.0.912.75 Safari/535.7`, result.Version)
}
}
result, err = Parse(`Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.99 Safari/537.36 Vivaldi/1.0.321.3`)
if err != nil {
t.Errorf(`Failed to parse 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.99 Safari/537.36 Vivaldi/1.0.321.3': %s`, err)
} else {
if result.Category != "pc" {
t.Errorf("Expected result.Category for '%s' to be 'pc', but got '%s'", `Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.99 Safari/537.36 Vivaldi/1.0.321.3`, result.Category)
}
if result.Name != "Vivaldi" {
t.Errorf("Expected result.Name for '%s' to be 'Vivaldi', but got '%s'", `Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.99 Safari/537.36 Vivaldi/1.0.321.3`, result.Name)
}
if true && result.Os != "Linux" {
t.Errorf("Expected result.Os for '%s' to be 'Linux', but got '%s'", `Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.99 Safari/537.36 Vivaldi/1.0.321.3`, result.Os)
}
if false && result.OsVersion != "UNKNOWN" {
t.Errorf("Expected result.OsVersion for '%s' to be 'UNKNOWN', but got '%s'", `Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.99 Safari/537.36 Vivaldi/1.0.321.3`, result.OsVersion)
}
if true && result.Version != "1.0.321.3" {
t.Errorf("Expected result.Version for '%s' to be '1.0.321.3', but got '%s'", `Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.99 Safari/537.36 Vivaldi/1.0.321.3`, result.Version)
}
}
result, err = Parse(`Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.24) Gecko cXense`)
if err != nil {
t.Errorf(`Failed to parse 'Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.24) Gecko cXense': %s`, err)
} else {
if result.Category != "pc" {
t.Errorf("Expected result.Category for '%s' to be 'pc', but got '%s'", `Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.24) Gecko cXense`, result.Category)
}
if result.Name != "UNKNOWN" {
t.Errorf("Expected result.Name for '%s' to be 'UNKNOWN', but got '%s'", `Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.24) Gecko cXense`, result.Name)
}
if true && result.Os != "Linux" {
t.Errorf("Expected result.Os for '%s' to be 'Linux', but got '%s'", `Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.24) Gecko cXense`, result.Os)
}
if false && result.OsVersion != "UNKNOWN" {
t.Errorf("Expected result.OsVersion for '%s' to be 'UNKNOWN', but got '%s'", `Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.24) Gecko cXense`, result.OsVersion)
}
if false && result.Version != "UNKNOWN" {
t.Errorf("Expected result.Version for '%s' to be 'UNKNOWN', but got '%s'", `Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.24) Gecko cXense`, result.Version)
}
}
result, err = Parse(`Mozilla/5.0 (X11; U; Linux i686; ja-JP; rv:1.8.1.23) Gecko/20090910 SeaMonkey/1.1.18`)
if err != nil {
t.Errorf(`Failed to parse 'Mozilla/5.0 (X11; U; Linux i686; ja-JP; rv:1.8.1.23) Gecko/20090910 SeaMonkey/1.1.18': %s`, err)
} else {
if result.Category != "pc" {
t.Errorf("Expected result.Category for '%s' to be 'pc', but got '%s'", `Mozilla/5.0 (X11; U; Linux i686; ja-JP; rv:1.8.1.23) Gecko/20090910 SeaMonkey/1.1.18`, result.Category)
}
if result.Name != "UNKNOWN" {
t.Errorf("Expected result.Name for '%s' to be 'UNKNOWN', but got '%s'", `Mozilla/5.0 (X11; U; Linux i686; ja-JP; rv:1.8.1.23) Gecko/20090910 SeaMonkey/1.1.18`, result.Name)
}
if true && result.Os != "Linux" {
t.Errorf("Expected result.Os for '%s' to be 'Linux', but got '%s'", `Mozilla/5.0 (X11; U; Linux i686; ja-JP; rv:1.8.1.23) Gecko/20090910 SeaMonkey/1.1.18`, result.Os)
}
if false && result.OsVersion != "UNKNOWN" {
t.Errorf("Expected result.OsVersion for '%s' to be 'UNKNOWN', but got '%s'", `Mozilla/5.0 (X11; U; Linux i686; ja-JP; rv:1.8.1.23) Gecko/20090910 SeaMonkey/1.1.18`, result.OsVersion)
}
if false && result.Version != "UNKNOWN" {
t.Errorf("Expected result.Version for '%s' to be 'UNKNOWN', but got '%s'", `Mozilla/5.0 (X11; U; Linux i686; ja-JP; rv:1.8.1.23) Gecko/20090910 SeaMonkey/1.1.18`, result.Version)
}
}
result, err = Parse(`Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.0.3) Gecko/2008092814 Iceweasel/3.0.3 (Debian-3.0.3-3)`)
if err != nil {
t.Errorf(`Failed to parse 'Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.0.3) Gecko/2008092814 Iceweasel/3.0.3 (Debian-3.0.3-3)': %s`, err)
} else {
if result.Category != "pc" {
t.Errorf("Expected result.Category for '%s' to be 'pc', but got '%s'", `Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.0.3) Gecko/2008092814 Iceweasel/3.0.3 (Debian-3.0.3-3)`, result.Category)
}
if result.Name != "UNKNOWN" {
t.Errorf("Expected result.Name for '%s' to be 'UNKNOWN', but got '%s'", `Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.0.3) Gecko/2008092814 Iceweasel/3.0.3 (Debian-3.0.3-3)`, result.Name)
}
if true && result.Os != "Linux" {
t.Errorf("Expected result.Os for '%s' to be 'Linux', but got '%s'", `Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.0.3) Gecko/2008092814 Iceweasel/3.0.3 (Debian-3.0.3-3)`, result.Os)
}
if false && result.OsVersion != "UNKNOWN" {
t.Errorf("Expected result.OsVersion for '%s' to be 'UNKNOWN', but got '%s'", `Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.0.3) Gecko/2008092814 Iceweasel/3.0.3 (Debian-3.0.3-3)`, result.OsVersion)
}
if false && result.Version != "UNKNOWN" {
t.Errorf("Expected result.Version for '%s' to be 'UNKNOWN', but got '%s'", `Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.0.3) Gecko/2008092814 Iceweasel/3.0.3 (Debian-3.0.3-3)`, result.Version)
}
}
result, err = Parse(`Mozilla/5.0 (X11; FreeBSD amd64; rv:8.0) Gecko/20100101 Firefox/8.0`)
if err != nil {
t.Errorf(`Failed to parse 'Mozilla/5.0 (X11; FreeBSD amd64; rv:8.0) Gecko/20100101 Firefox/8.0': %s`, err)
} else {
if result.Category != "pc" {
t.Errorf("Expected result.Category for '%s' to be 'pc', but got '%s'", `Mozilla/5.0 (X11; FreeBSD amd64; rv:8.0) Gecko/20100101 Firefox/8.0`, result.Category)
}
if result.Name != "Firefox" {
t.Errorf("Expected result.Name for '%s' to be 'Firefox', but got '%s'", `Mozilla/5.0 (X11; FreeBSD amd64; rv:8.0) Gecko/20100101 Firefox/8.0`, result.Name)
}
if true && result.Os != "BSD" {
t.Errorf("Expected result.Os for '%s' to be 'BSD', but got '%s'", `Mozilla/5.0 (X11; FreeBSD amd64; rv:8.0) Gecko/20100101 Firefox/8.0`, result.Os)
}
if false && result.OsVersion != "UNKNOWN" {
t.Errorf("Expected result.OsVersion for '%s' to be 'UNKNOWN', but got '%s'", `Mozilla/5.0 (X11; FreeBSD amd64; rv:8.0) Gecko/20100101 Firefox/8.0`, result.OsVersion)
}
if true && result.Version != "8.0" {
t.Errorf("Expected result.Version for '%s' to be '8.0', but got '%s'", `Mozilla/5.0 (X11; FreeBSD amd64; rv:8.0) Gecko/20100101 Firefox/8.0`, result.Version)
}
}
result, err = Parse(`Opera/9.80 (X11; FreeBSD 8.2-RELEASE-p3 amd64; U; ja) Presto/2.9.168 Version/11.52`)
if err != nil {
t.Errorf(`Failed to parse 'Opera/9.80 (X11; FreeBSD 8.2-RELEASE-p3 amd64; U; ja) Presto/2.9.168 Version/11.52': %s`, err)
} else {
if result.Category != "pc" {
t.Errorf("Expected result.Category for '%s' to be 'pc', but got '%s'", `Opera/9.80 (X11; FreeBSD 8.2-RELEASE-p3 amd64; U; ja) Presto/2.9.168 Version/11.52`, result.Category)
}
if result.Name != "Opera" {
t.Errorf("Expected result.Name for '%s' to be 'Opera', but got '%s'", `Opera/9.80 (X11; FreeBSD 8.2-RELEASE-p3 amd64; U; ja) Presto/2.9.168 Version/11.52`, result.Name)
}
if true && result.Os != "BSD" {
t.Errorf("Expected result.Os for '%s' to be 'BSD', but got '%s'", `Opera/9.80 (X11; FreeBSD 8.2-RELEASE-p3 amd64; U; ja) Presto/2.9.168 Version/11.52`, result.Os)
}
if true && result.OsVersion != "8.2-RELEASE-p3 amd64" {
t.Errorf("Expected result.OsVersion for '%s' to be '8.2-RELEASE-p3 amd64', but got '%s'", `Opera/9.80 (X11; FreeBSD 8.2-RELEASE-p3 amd64; U; ja) Presto/2.9.168 Version/11.52`, result.OsVersion)
}
if true && result.Version != "11.52" {
t.Errorf("Expected result.Version for '%s' to be '11.52', but got '%s'", `Opera/9.80 (X11; FreeBSD 8.2-RELEASE-p3 amd64; U; ja) Presto/2.9.168 Version/11.52`, result.Version)
}
}
result, err = Parse(`Mozilla/5.0 (X11; CrOS x86_64 5116.115.4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/33.0.1750.152 Safari/537.36`)
if err != nil {
t.Errorf(`Failed to parse 'Mozilla/5.0 (X11; CrOS x86_64 5116.115.4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/33.0.1750.152 Safari/537.36': %s`, err)
} else {
if result.Category != "pc" {
t.Errorf("Expected result.Category for '%s' to be 'pc', but got '%s'", `Mozilla/5.0 (X11; CrOS x86_64 5116.115.4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/33.0.1750.152 Safari/537.36`, result.Category)
}
if result.Name != "Chrome" {
t.Errorf("Expected result.Name for '%s' to be 'Chrome', but got '%s'", `Mozilla/5.0 (X11; CrOS x86_64 5116.115.4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/33.0.1750.152 Safari/537.36`, result.Name)
}
if true && result.Os != "ChromeOS" {
t.Errorf("Expected result.Os for '%s' to be 'ChromeOS', but got '%s'", `Mozilla/5.0 (X11; CrOS x86_64 5116.115.4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/33.0.1750.152 Safari/537.36`, result.Os)
}
if true && result.OsVersion != "x86_64 5116.115.4" {
t.Errorf("Expected result.OsVersion for '%s' to be 'x86_64 5116.115.4', but got '%s'", `Mozilla/5.0 (X11; CrOS x86_64 5116.115.4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/33.0.1750.152 Safari/537.36`, result.OsVersion)
}
if true && result.Version != "33.0.1750.152" {
t.Errorf("Expected result.Version for '%s' to be '33.0.1750.152', but got '%s'", `Mozilla/5.0 (X11; CrOS x86_64 5116.115.4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/33.0.1750.152 Safari/537.36`, result.Version)
}
}
result, err = Parse(`Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.94 YaBrowser/17.11.1.1087 (beta) Yowser/2.5 Safari/537.36`)
if err != nil {
t.Errorf(`Failed to parse 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.94 YaBrowser/17.11.1.1087 (beta) Yowser/2.5 Safari/537.36': %s`, err)
} else {
if result.Category != "pc" {
t.Errorf("Expected result.Category for '%s' to be 'pc', but got '%s'", `Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.94 YaBrowser/17.11.1.1087 (beta) Yowser/2.5 Safari/537.36`, result.Category)
}
if result.Name != "Yandex Browser" {
t.Errorf("Expected result.Name for '%s' to be 'Yandex Browser', but got '%s'", `Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.94 YaBrowser/17.11.1.1087 (beta) Yowser/2.5 Safari/537.36`, result.Name)
}
if true && result.Os != "Linux" {
t.Errorf("Expected result.Os for '%s' to be 'Linux', but got '%s'", `Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.94 YaBrowser/17.11.1.1087 (beta) Yowser/2.5 Safari/537.36`, result.Os)
}
if false && result.OsVersion != "UNKNOWN" {
t.Errorf("Expected result.OsVersion for '%s' to be 'UNKNOWN', but got '%s'", `Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.94 YaBrowser/17.11.1.1087 (beta) Yowser/2.5 Safari/537.36`, result.OsVersion)
}
if true && result.Version != "17.11.1.1087" {
t.Errorf("Expected result.Version for '%s' to be '17.11.1.1087', but got '%s'", `Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.94 YaBrowser/17.11.1.1087 (beta) Yowser/2.5 Safari/537.36`, result.Version)
}
}
}