-
Notifications
You must be signed in to change notification settings - Fork 0
/
type4_test.go
47 lines (39 loc) · 1.09 KB
/
type4_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
package nmeaais
import (
"testing"
"time"
. "github.com/smartystreets/goconvey/convey"
)
func TestType4MessageProcessing(t *testing.T) {
Convey("When processing a type 4 message", t, func() {
raws := []string{
"!AIVDM,1,1,,B,402R3dAurtDNn0n7C@QIev100@PE,0*45",
}
packets := buildPackets(raws)
message, err := Process(packets)
type4, err := message.GetAsBaseStationReport()
expected := &BaseStationReport{
MessageType: 4,
RepeatIndicator: 0,
MMSI: 2655153,
PositionAccuracy: false,
TimeStamp: time.Date(2014, time.November, 24, 20, 30, 54, 0, time.UTC),
Longitude: 11.8214,
Latitude: 58.37396,
EPFDType: "GPS",
RAIM: false,
RadioStatus: 67605,
}
Convey("The get should return a type 4 message", func() {
Convey("Where the message is not nil", func() {
So(type4, ShouldNotBeNil)
})
})
Convey("The get should not return an error", func() {
So(err, ShouldBeNil)
})
Convey("The fields should be populated correctly", func() {
So(type4, ShouldResemble, expected)
})
})
}