forked from adrianmo/go-nmea
-
Notifications
You must be signed in to change notification settings - Fork 0
/
parser_test.go
619 lines (613 loc) · 20 KB
/
parser_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
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
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
package nmea_test
import (
. "github.com/munnik/go-nmea"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
)
var _ = Describe("Parser", func() {
var (
sentence string
p *Parser
)
Describe("Testing methods of parser", func() {
JustBeforeEach(func() {
parsed, _ := Parse(sentence)
if typedParsed, ok := parsed.(RMC); ok {
p = NewParser(typedParsed.BaseSentence)
return
}
if typedParsed, ok := parsed.(GNS); ok {
p = NewParser(typedParsed.BaseSentence)
return
}
if typedParsed, ok := parsed.(RTE); ok {
p = NewParser(typedParsed.BaseSentence)
return
}
Fail("This type of sentence is not supported")
})
Context("when setting an error", func() {
BeforeEach(func() {
sentence = "$GNRMC,143909.00,A,5107.0020216,N,11402.3294835,W,0.036,348.3,210307,0.0,E,A*31"
})
It("returns the error", func() {
p.SetErr("testing", "error")
Expect(p.Err()).To(MatchError("nmea: GNRMC invalid testing: error"))
})
})
Context("when asserting it is a RMC sentence", func() {
BeforeEach(func() {
sentence = "$GNRMC,143909.00,A,5107.0020216,N,11402.3294835,W,0.036,348.3,210307,0.0,E,A*31"
})
It("returns no error", func() {
p.AssertType("RMC")
Expect(p.Err()).ToNot(HaveOccurred())
})
})
Context("when asserting it is a ROT sentence", func() {
BeforeEach(func() {
sentence = "$GNRMC,143909.00,A,5107.0020216,N,11402.3294835,W,0.036,348.3,210307,0.0,E,A*31"
})
It("returns an error", func() {
p.AssertType("ROT")
Expect(p.Err()).To(HaveOccurred())
})
})
Context("when retrieving a string field with a valid index", func() {
BeforeEach(func() {
sentence = "$GNRMC,143909.00,A,5107.0020216,N,11402.3294835,W,0.036,348.3,210307,0.0,E,A*31"
})
It("returns the value of the field", func() {
Expect(p.String(6, "speed")).To(Equal(NewString("0.036")))
Expect(p.Err()).ToNot(HaveOccurred())
})
})
Context("when retrieving a string field with an invalid index", func() {
BeforeEach(func() {
sentence = "$GNRMC,143909.00,A,5107.0020216,N,11402.3294835,W,0.036,348.3,210307,0.0,E,A*31"
})
It("returns an invalid string", func() {
Expect(p.String(23, "invalid index")).To(Equal(NewInvalidString("index out of range")))
Expect(p.Err()).ToNot(HaveOccurred())
})
})
Context("when retrieving a list of string field with a valid index", func() {
BeforeEach(func() {
sentence = "$IIRTE,X,1,c,Rte 1,411,412,413,414,415*03"
})
It("returns the value of the field", func() {
Expect(p.ListString(4, "ident of waypoints")).To(Equal(NewStringList([]String{NewString("411"), NewString("412"), NewString("413"), NewString("414"), NewString("415")})))
Expect(p.Err()).ToNot(HaveOccurred())
})
})
Context("when retrieving a list of string field with an invalid index", func() {
BeforeEach(func() {
sentence = "$IIRTE,X,1,c,Rte 1,411,412,413,414,415*03"
})
It("returns an invalid string", func() {
Expect(p.ListString(23, "invalid index")).To(Equal(NewInvalidStringList("index out of range")))
Expect(p.Err()).ToNot(HaveOccurred())
})
})
Context("when retrieving an enum string field with a valid index", func() {
BeforeEach(func() {
sentence = "$GNRMC,143909.00,A,5107.0020216,N,11402.3294835,W,0.036,348.3,210307,0.0,E,A*31"
})
It("returns the value of the field", func() {
Expect(p.EnumString(10, "direction", West, East)).To(Equal(NewString(East)))
Expect(p.Err()).ToNot(HaveOccurred())
})
})
Context("when retrieving an enum string field with an invalid value", func() {
BeforeEach(func() {
sentence = "$GNRMC,143909.00,A,5107.0020216,N,11402.3294835,W,0.036,348.3,210307,0.0,X,A*2C"
})
It("returns the value of the field", func() {
Expect(p.EnumString(10, "direction", West, East)).To(Equal(NewInvalidString("not a valid option")))
Expect(p.Err()).ToNot(HaveOccurred())
})
})
Context("when retrieving an enum string field with an invalid index", func() {
BeforeEach(func() {
sentence = "$GNRMC,143909.00,A,5107.0020216,N,11402.3294835,W,0.036,348.3,210307,0.0,E,A*31"
})
It("returns an invalid string", func() {
Expect(p.EnumString(23, "invalid index", West, East)).To(Equal(NewInvalidString("index out of range")))
Expect(p.Err()).ToNot(HaveOccurred())
})
})
Context("when retrieving an enum char field with a valid index", func() {
BeforeEach(func() {
sentence = "$GNGNS,094821.0,4849.931307,N,00216.053323,E,AA,14,0.6,161.5,48.0,,*6D"
})
It("returns the value of the field", func() {
Expect(p.EnumChars(5, "mode", NoFixGNS, AutonomousGNS, DifferentialGNS, PreciseGNS, RealTimeKinematicGNS, FloatRTKGNS, EstimatedGNS, ManualGNS, SimulatorGNS)).To(Equal(NewStringList([]String{NewString("A"), NewString("A")})))
Expect(p.Err()).ToNot(HaveOccurred())
})
})
Context("when retrieving an enum char field with an invalid value", func() {
BeforeEach(func() {
sentence = "$GNGNS,094821.0,4849.931307,N,00216.053323,E,AAX,14,0.6,161.5,48.0,,*35"
})
It("returns the value of the field", func() {
Expect(p.EnumChars(5, "mode", NoFixGNS, AutonomousGNS, DifferentialGNS, PreciseGNS, RealTimeKinematicGNS, FloatRTKGNS, EstimatedGNS, ManualGNS, SimulatorGNS)).To(Equal(NewStringList([]String{NewString("A"), NewString("A"), NewInvalidString("not a valid option")})))
Expect(p.Err()).ToNot(HaveOccurred())
})
})
Context("when retrieving an enum char field with an invalid index", func() {
BeforeEach(func() {
sentence = "$GNRMC,143909.00,A,5107.0020216,N,11402.3294835,W,0.036,348.3,210307,0.0,E,A*31"
})
It("returns an invalid string", func() {
Expect(p.EnumChars(23, "invalid index", West, East)).To(Equal(NewInvalidStringList("index out of range")))
Expect(p.Err()).ToNot(HaveOccurred())
})
})
Context("when retrieving an int64 field with a valid index", func() {
BeforeEach(func() {
sentence = "$GNGNS,094821.0,4849.931307,N,00216.053323,E,PXKR,14,0.6,161.5,48.0,,*7C"
})
It("returns the value of the field", func() {
Expect(p.Int64(6, "satellites")).To(Equal(NewInt64(14)))
Expect(p.Err()).ToNot(HaveOccurred())
})
})
Context("when retrieving an int64 field with an invalid value", func() {
BeforeEach(func() {
sentence = "$GNGNS,094821.0,4849.931307,N,00216.053323,E,PXKR,X,0.6,161.5,48.0,,*21"
})
It("returns the value of the field", func() {
Expect(p.Int64(6, "satellites")).To(Equal(NewInvalidInt64("strconv.ParseInt: parsing \"X\": invalid syntax")))
Expect(p.Err()).ToNot(HaveOccurred())
})
})
Context("when retrieving an int64 field with an invalid index", func() {
BeforeEach(func() {
sentence = "$GNGNS,094821.0,4849.931307,N,00216.053323,E,PXKR,14,0.6,161.5,48.0,,*7C"
})
It("returns an invalid int64", func() {
Expect(p.Int64(23, "invalid index")).To(Equal(NewInvalidInt64("index out of range")))
Expect(p.Err()).ToNot(HaveOccurred())
})
})
Context("when retrieving an float64 field with a valid index", func() {
BeforeEach(func() {
sentence = "$GNGNS,094821.0,4849.931307,N,00216.053323,E,PXKR,14,0.6,161.5,48.0,,*7C"
})
It("returns the value of the field", func() {
Expect(p.Float64(8, "altitude")).To(Equal(NewFloat64(161.5)))
Expect(p.Err()).ToNot(HaveOccurred())
})
})
Context("when retrieving an float64 field with an invalid value", func() {
BeforeEach(func() {
sentence = "$GNGNS,094821.0,4849.931307,N,00216.053323,E,PXKR,14,0.6,X,48.0,,*09"
})
It("returns the value of the field", func() {
Expect(p.Float64(8, "altitude")).To(Equal(NewInvalidFloat64("strconv.ParseFloat: parsing \"X\": invalid syntax")))
Expect(p.Err()).ToNot(HaveOccurred())
})
})
Context("when retrieving an float64 field with an invalid index", func() {
BeforeEach(func() {
sentence = "$GNGNS,094821.0,4849.931307,N,00216.053323,E,PXKR,14,0.6,161.5,48.0,,*7C"
})
It("returns an invalid float64", func() {
Expect(p.Float64(23, "invalid index")).To(Equal(NewInvalidFloat64("index out of range")))
Expect(p.Err()).ToNot(HaveOccurred())
})
})
Context("when retrieving a time field with a valid index", func() {
BeforeEach(func() {
sentence = "$GNRMC,143909.00,A,5107.0020216,N,11402.3294835,W,0.036,348.3,210307,0.0,E,A*31"
})
It("returns the value of the field", func() {
Expect(p.Time(0, "time")).To(Equal(NewTime(14, 39, 9, 0)))
Expect(p.Err()).ToNot(HaveOccurred())
})
})
Context("when retrieving a time field with an invalid value", func() {
BeforeEach(func() {
sentence = "$GNRMC,X,A,5107.0020216,N,11402.3294835,W,0.036,348.3,210307,0.0,E,A*41"
})
It("returns the value of the field", func() {
Expect(p.Time(0, "time")).To(Equal(NewInvalidTime("parse time: expected hhmmss.ss format, got 'X'")))
Expect(p.Err()).ToNot(HaveOccurred())
})
})
Context("when retrieving a time field with an invalid index", func() {
BeforeEach(func() {
sentence = "$GNRMC,143909.00,A,5107.0020216,N,11402.3294835,W,0.036,348.3,210307,0.0,E,A*31"
})
It("returns an invalid time", func() {
Expect(p.Time(23, "invalid index")).To(Equal(NewInvalidTime("index out of range")))
Expect(p.Err()).ToNot(HaveOccurred())
})
})
Context("when retrieving a date field with a valid index", func() {
BeforeEach(func() {
sentence = "$GNRMC,143909.00,A,5107.0020216,N,11402.3294835,W,0.036,348.3,210307,0.0,E,A*31"
})
It("returns the value of the field", func() {
Expect(p.Date(8, "date")).To(Equal(NewDate(7, 3, 21)))
Expect(p.Err()).ToNot(HaveOccurred())
})
})
Context("when retrieving a date field with an invalid value", func() {
BeforeEach(func() {
sentence = "$GNRMC,X,A,5107.0020216,N,11402.3294835,W,0.036,348.3,X,0.0,E,A*1E"
})
It("returns the value of the field", func() {
Expect(p.Date(8, "date")).To(Equal(NewInvalidDate("parse date: expected yymmdd format, got 'X'")))
Expect(p.Err()).ToNot(HaveOccurred())
})
})
Context("when retrieving a date field with an invalid index", func() {
BeforeEach(func() {
sentence = "$GNRMC,143909.00,A,5107.0020216,N,11402.3294835,W,0.036,348.3,210307,0.0,E,A*31"
})
It("returns an invalid date", func() {
Expect(p.Date(23, "invalid index")).To(Equal(NewInvalidDate("index out of range")))
Expect(p.Err()).ToNot(HaveOccurred())
})
})
Context("when retrieving a latitude field with a valid index", func() {
BeforeEach(func() {
sentence = "$GNRMC,143909.00,A,5107.0020216,N,11402.3294835,W,0.036,348.3,210307,0.0,E,A*31"
})
It("returns the value of the field", func() {
Expect(p.LatLong(2, 3, "latitude")).To(Equal(NewFloat64(51.11670036)))
Expect(p.Err()).ToNot(HaveOccurred())
})
})
Context("when retrieving a position field with an invalid value", func() {
BeforeEach(func() {
sentence = "$GNRMC,143909.00,A,X,N,11402.3294835,W,0.036,348.3,210307,0.0,E,A*73"
})
It("returns the value of the field", func() {
Expect(p.LatLong(2, 3, "latitude")).To(Equal(NewInvalidFloat64("parse error (not decimal coordinate)")))
Expect(p.Err()).ToNot(HaveOccurred())
})
})
Context("when retrieving a position field with an invalid index", func() {
BeforeEach(func() {
sentence = "$GNRMC,143909.00,A,5107.0020216,N,11402.3294835,W,0.036,348.3,210307,0.0,E,A*31"
})
It("returns an invalid date", func() {
Expect(p.LatLong(2, 24, "invalid index")).To(Equal(NewInvalidFloat64("index out of range")))
Expect(p.Err()).ToNot(HaveOccurred())
})
})
Context("when retrieving a position field with an invalid index", func() {
BeforeEach(func() {
sentence = "$GNRMC,143909.00,A,5107.0020216,N,11402.3294835,W,0.036,348.3,210307,0.0,E,A*31"
})
It("returns an invalid date", func() {
Expect(p.LatLong(23, 3, "invalid index")).To(Equal(NewInvalidFloat64("index out of range")))
Expect(p.Err()).ToNot(HaveOccurred())
})
})
Context("when retrieving a position field with an invalid index", func() {
BeforeEach(func() {
sentence = "$GNRMC,143909.00,A,5107.0020216,N,11402.3294835,W,0.036,348.3,210307,0.0,E,A*31"
})
It("returns an invalid date", func() {
Expect(p.LatLong(23, 24, "invalid index")).To(Equal(NewInvalidFloat64("index out of range")))
Expect(p.Err()).ToNot(HaveOccurred())
})
})
})
})
// import (
// "fmt"
// "testing"
// . "github.com/munnik/go-nmea"
// "github.com/stretchr/testify/assert"
// )
// var parsertests = []struct {
// name string
// fields []string
// expected interface{}
// hasErr bool
// parse func(p *Parser) interface{}
// }{
// {
// name: "Bad Type",
// fields: []string{},
// hasErr: true,
// parse: func(p *Parser) interface{} {
// p.AssertType("WRONG_TYPE")
// return nil
// },
// },
// {
// name: "String",
// fields: []string{"foo", "bar"},
// expected: "bar",
// parse: func(p *Parser) interface{} {
// return p.String(1, "")
// },
// },
// {
// name: "String out of range",
// fields: []string{"wot"},
// expected: "",
// hasErr: true,
// parse: func(p *Parser) interface{} {
// return p.String(5, "thing")
// },
// },
// {
// name: "ListString",
// fields: []string{"wot", "foo", "bar"},
// expected: []string{"foo", "bar"},
// parse: func(p *Parser) interface{} {
// return p.ListString(1, "thing")
// },
// },
// {
// name: "ListString out of range",
// fields: []string{"wot"},
// expected: []string{},
// hasErr: true,
// parse: func(p *Parser) interface{} {
// return p.ListString(10, "thing")
// },
// },
// {
// name: "String with existing error",
// expected: "",
// hasErr: true,
// parse: func(p *Parser) interface{} {
// p.SetErr("context", "value")
// return p.String(123, "blah")
// },
// },
// {
// name: "EnumString",
// fields: []string{"a", "b", "c"},
// expected: "b",
// parse: func(p *Parser) interface{} {
// return p.EnumString(1, "context", "b", "d")
// },
// },
// {
// name: "EnumString invalid",
// fields: []string{"a", "b", "c"},
// expected: "",
// hasErr: true,
// parse: func(p *Parser) interface{} {
// return p.EnumString(1, "context", "x", "y")
// },
// },
// {
// name: "EnumString with existing error",
// fields: []string{"a", "b", "c"},
// expected: "",
// hasErr: true,
// parse: func(p *Parser) interface{} {
// p.SetErr("context", "value")
// return p.EnumString(1, "context", "a", "b")
// },
// },
// {
// name: "EnumChars",
// fields: []string{"AA", "AB", "BA", "BB"},
// expected: []string{"A", "B"},
// parse: func(p *Parser) interface{} {
// return p.EnumChars(1, "context", "A", "B")
// },
// },
// {
// name: "EnumChars invalid",
// fields: []string{"a", "AB", "c"},
// expected: []string{},
// hasErr: true,
// parse: func(p *Parser) interface{} {
// return p.EnumChars(1, "context", "X", "Y")
// },
// },
// {
// name: "EnumChars with existing error",
// fields: []string{"a", "AB", "c"},
// expected: []string{},
// hasErr: true,
// parse: func(p *Parser) interface{} {
// p.SetErr("context", "value")
// return p.EnumChars(1, "context", "A", "B")
// },
// },
// {
// name: "Int64",
// fields: []string{"123"},
// expected: NewInt64(123),
// parse: func(p *Parser) interface{} {
// return p.Int64(0, "context")
// },
// },
// {
// name: "Int64 empty field is zero",
// fields: []string{""},
// expected: NewInvalidInt64(errors.New("")),
// parse: func(p *Parser) interface{} {
// return p.Int64(0, "context")
// },
// },
// {
// name: "Int64 invalid",
// fields: []string{"abc"},
// expected: NewInvalidInt64(errors.New("")),
// hasErr: true,
// parse: func(p *Parser) interface{} {
// return p.Int64(0, "context")
// },
// },
// {
// name: "Int64 with existing error",
// fields: []string{"123"},
// expected: NewInvalidInt64(errors.New("")),
// hasErr: true,
// parse: func(p *Parser) interface{} {
// p.SetErr("context", "value")
// return p.Int64(0, "context")
// },
// },
// {
// name: "Float64",
// fields: []string{"123.123"},
// expected: NewFloat64(123.123),
// parse: func(p *Parser) interface{} {
// return p.Float64(0, "context")
// },
// },
// {
// name: "Float64 empty field is zero",
// fields: []string{""},
// expected: NewInvalidFloat64(errors.New("")),
// parse: func(p *Parser) interface{} {
// return p.Float64(0, "context")
// },
// },
// {
// name: "Float64 invalid",
// fields: []string{"abc"},
// expected: NewInvalidFloat64(errors.New("")),
// hasErr: true,
// parse: func(p *Parser) interface{} {
// return p.Float64(0, "context")
// },
// },
// {
// name: "Float64 with existing error",
// fields: []string{"123.123"},
// expected: NewInvalidFloat64(errors.New("")),
// hasErr: true,
// parse: func(p *Parser) interface{} {
// p.SetErr("context", "value")
// return p.Float64(0, "context")
// },
// },
// {
// name: "Time",
// fields: []string{"123456"},
// expected: NewTime(12, 34, 56, 0),
// parse: func(p *Parser) interface{} {
// return p.Time(0, "context")
// },
// },
// {
// name: "Time empty field is zero",
// fields: []string{""},
// expected: Time{},
// parse: func(p *Parser) interface{} {
// return p.Time(0, "context")
// },
// },
// {
// name: "Time with existing error",
// fields: []string{"123456"},
// expected: Time{},
// hasErr: true,
// parse: func(p *Parser) interface{} {
// p.SetErr("context", "value")
// return p.Time(0, "context")
// },
// },
// {
// name: "Time invalid",
// fields: []string{"wrong"},
// expected: Time{},
// hasErr: true,
// parse: func(p *Parser) interface{} {
// return p.Time(0, "context")
// },
// },
// {
// name: "Date",
// fields: []string{"010203"},
// expected: NewDate(3, 2, 1),
// parse: func(p *Parser) interface{} {
// return p.Date(0, "context")
// },
// },
// {
// name: "Date empty field is zero",
// fields: []string{""},
// expected: Date{},
// parse: func(p *Parser) interface{} {
// return p.Date(0, "context")
// },
// },
// {
// name: "Date invalid",
// fields: []string{"Hello"},
// expected: Date{},
// hasErr: true,
// parse: func(p *Parser) interface{} {
// return p.Date(0, "context")
// },
// },
// {
// name: "Date with existing error",
// fields: []string{"010203"},
// expected: Date{},
// hasErr: true,
// parse: func(p *Parser) interface{} {
// p.SetErr("context", "value")
// return p.Date(0, "context")
// },
// },
// {
// name: "LatLong",
// fields: []string{"5000.0000", "N"},
// expected: NewFloat64(50.0),
// parse: func(p *Parser) interface{} {
// return p.LatLong(0, 1, "context")
// },
// },
// {
// name: "LatLong - latitude out of range",
// fields: []string{"9100.0000", "N"},
// expected: NewInvalidFloat64(fmt.Errorf("latitude is not in range (-90, 90)")),
// hasErr: false,
// parse: func(p *Parser) interface{} {
// return p.LatLong(0, 1, "context")
// },
// },
// {
// name: "LatLong - longitude out of range",
// fields: []string{"18100.0000", "W"},
// expected: NewInvalidFloat64(fmt.Errorf("longitude is not in range (-180, 180)")),
// hasErr: false,
// parse: func(p *Parser) interface{} {
// return p.LatLong(0, 1, "context")
// },
// },
// {
// name: "LatLong with existing error",
// fields: []string{"5000.0000", "W"},
// expected: NewInvalidFloat64(errors.New("")),
// hasErr: true,
// parse: func(p *Parser) interface{} {
// p.SetErr("context", "value")
// return p.LatLong(0, 1, "context")
// },
// },
// }
// func TestParser(t *testing.T) {
// for _, tt := range parsertests {
// t.Run(tt.name, func(t *testing.T) {
// p := NewParser(BaseSentence{
// Talker: "talker",
// Type: "type",
// Fields: tt.fields,
// })
// assert.Equal(t, tt.expected, tt.parse(p))
// if tt.hasErr {
// assert.Error(t, p.Err())
// } else {
// assert.NoError(t, p.Err())
// }
// })
// }
// }