-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathdecode_test.go
43 lines (41 loc) · 1.85 KB
/
decode_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
package main
import (
"log"
"testing"
)
func TestParserSignal(t *testing.T) {
inputs := []string{
"*--------------------------------------- Data Output Format Definition ----------------------------------------*",
"TEMP HUMI CH_PM1.0 CH_PM2.5 CH_PM10 US_PM1.0 US_PM2.5 US_PM10 >0.3um >0.5um >1.0um >2.5um >5.0um >10um HCHO TVOC",
"25.9 40.4 20 26 28 21 26 28 3657 1053 123 7 4 0 0.004 0.18",
"25.9 40.4 20 26 28 21 26 28 3642 1061 120 6 4 0 0.004 0.20",
"25.9 40.4 20 25 27 20 25 27 3555 1033 115 7 3 0 0.007 0.10",
"25.9 40.5 20 25 27 20 25 27 3531 1041 120 7 3 0 0.003 0.19",
"25.9 40.5 20 26 28 21 26 28 3642 1074 121 8 3 0 0.005 0.15",
"25.9 40.4 21 27 29 22 27 29 3657 1081 126 8 3 0 0.004 0.15",
"25.9 40.4 21 27 29 22 27 29 3744 1107 129 8 3 0 0.004 0.20",
"25.9 40.4 21 27 27 22 27 27 3693 1095 126 5 0 0 0.005 0.16",
"25.9 40.3 22 28 29 23 28 29 3780 1124 126 8 1 1 0.005 0.22",
"25.8 40.3 22 28 29 23 28 29 3732 1111 136 9 1 1 0.005 0.18",
"25.9 40.3 22 29 31 23 29 31 3783 1142 147 10 1 1 0.007 0.18",
"25.9 40.3 21 29 30 23 29 30 3885 1163 142 10 1 1 0.004 0.10",
"25.9 40.2 22 29 30 24 29 30 3879 1163 144 7 1 1 0.003 0.22",
"25.9 40.2 22 29 30 24 29 30 3903 1159 139 7 1 1 0.004 0.10",
"25.9 40.2 22 29 31 23 29 31 3918 1168 152 7 2 1 0.003 0.03",
"25.9 40.2 22 29 30 23 29 30 3873 1153 157 7 2 1 0.003 0.04",
"25.9 40.2 21 29 30 22 29 30 3804 1143 154 8 2 1 0.007 0.08",
"26.0 40.2 22 30 31 23 30 31 3906 1180 161 8 2 1 0.005 0.04",
"26.0 40.2 22 30 30 23 30 30 3870 1181 160 6 1 0 0.005 0.07",
"26.0 40.2 22 29 31 23 29 31 3897 1183 156 6 2 0 0.003 0.16",
"26.0 40.2 22 29 30 23 29 30 3858 1162 156 5 2 0 0.004 0.03",
"26.0 40.1 21 29 30 22 29 30 3822 1156 166 5 2 0 0.006 0.20",
}
for _, test := range inputs {
rs, err := ParserSignal(test)
if err != nil {
log.Println(err)
continue
}
log.Println(rs)
}
}