-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy patheew_test.go
executable file
·52 lines (49 loc) · 1.62 KB
/
eew_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
package eew
import (
"fmt"
"testing"
)
func TestReader(t *testing.T) {
data := `
37 03 00 110311144702 C11
110311144616
ND20110311144640 NCN009 JD////////////// JN///
288 N381 E1429 010 76 5- RK98765 RT43210 RC0////
EBI 222 S5-04 ////// 11 220 S5-04 ////// 11 211 S5-04 ////// 11
210 S5-04 144703 10 221 S5-04 144703 10 213 S0404 ////// 11
251 S0404 144704 10 250 S0404 144711 10 241 S0404 144715 10
212 S0404 144715 10 242 S0404 144715 10 233 S0404 144715 10
300 S0404 144721 00 252 S0404 144722 00 240 S0404 144727 00
243 S0403 144719 00 231 S0403 144730 00 202 S0403 144732 00
372 S0403 144732 00 301 S0403 144733 00 230 S0403 144736 00
340 S0403 144739 00 331 S0403 144748 00
9999=
`
r:=Reader(data)
fmt.Printf("Reader:[%#v]\n",r)
if r.EqID != "20110311144640" {
t.Errorf("EqID is not correct :%s", r.EqID)
}
}
func TestDecoder(t *testing.T) {
data := `
37 03 00 110311144702 C11
110311144616
ND20110311144640 NCN009 JD////////////// JN///
288 N381 E1429 010 76 5- RK98765 RT43210 RC0////
EBI 222 S5-04 ////// 11 220 S5-04 ////// 11 211 S5-04 ////// 11
210 S5-04 144703 10 221 S5-04 144703 10 213 S0404 ////// 11
251 S0404 144704 10 250 S0404 144711 10 241 S0404 144715 10
212 S0404 144715 10 242 S0404 144715 10 233 S0404 144715 10
300 S0404 144721 00 252 S0404 144722 00 240 S0404 144727 00
243 S0403 144719 00 231 S0403 144730 00 202 S0403 144732 00
372 S0403 144732 00 301 S0403 144733 00 230 S0403 144736 00
340 S0403 144739 00 331 S0403 144748 00
9999=
`
r:=Decoder(data)
fmt.Printf("Decoder:[%#v]\n",r)
if r.EqID != "20110311144640" {
t.Errorf("EqID is not correct :%s", r.EqID)
}
}