-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtype20_test.go
More file actions
55 lines (47 loc) · 1.22 KB
/
type20_test.go
File metadata and controls
55 lines (47 loc) · 1.22 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
package nmeaais
import (
"testing"
. "github.com/smartystreets/goconvey/convey"
)
func TestType20MessageProcessing(t *testing.T) {
Convey("When processing a type 20 message", t, func() {
raws := []string{
"!AIVDM,1,1,,B,Dh3Ovj@11N>6;HfGL00Nfp0,2*1B",
}
packets := buildPackets(raws)
message, err := Process(packets)
type20, err := message.GetAsDataLinkManagementMessage()
expected := &DataLinkManagementMessage{
MessageType: 20,
RepeatIndicator: 3,
MMSI: 3669705,
Offset1: 16,
ReservedSlots1: 5,
Timeout1: 7,
Increment1: 225,
Offset2: 2230,
ReservedSlots2: 2,
Timeout2: 7,
Increment2: 375,
Offset3: 0,
ReservedSlots3: 1,
Timeout3: 7,
Increment3: 750,
Offset4: 0,
ReservedSlots4: 0,
Timeout4: 0,
Increment4: 0,
}
Convey("The get should return a type 20 message", func() {
Convey("Where the message is not nil", func() {
So(type20, ShouldNotBeNil)
})
})
Convey("The get should not return an error", func() {
So(err, ShouldBeNil)
})
Convey("The fields should be populated correctly", func() {
So(type20, ShouldResemble, expected)
})
})
}