-
Notifications
You must be signed in to change notification settings - Fork 0
/
type12_test.go
44 lines (36 loc) · 1.04 KB
/
type12_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
package nmeaais
import (
"testing"
. "github.com/smartystreets/goconvey/convey"
)
func TestType12MessageProcessing(t *testing.T) {
Convey("When processing a type 12 message", t, func() {
raws := []string{
"!AIVDM,2,1,1,A,<D62222222208:5vmEEEOPAGEso0009m5@CFb;vNnQIsW008t>AOOfbbbWp4,0*40",
"!AIVDM,2,2,1,A,=fD:8=w0?A@,2*4C",
}
packets := buildPackets(raws)
message, err := Process(packets)
type12, err := message.GetAsAddressedSafetyRelated()
expected := &AddressedSafetyRelated{
MessageType: 12,
RepeatIndicator: 1,
MMSI: 274760200,
SequenceNumber: 0,
DestinationMMSI: 545392672,
RetransmitFlag: false,
Text: "HJE>5UUU- QWU;7",
}
Convey("The get should return a type 12 message", func() {
Convey("Where the message is not nil", func() {
So(type12, ShouldNotBeNil)
})
})
Convey("The get should not return an error", func() {
So(err, ShouldBeNil)
})
Convey("The fields should be populated correctly", func() {
So(type12, ShouldResemble, expected)
})
})
}