MCPcopy Create free account
hub / github.com/facebook/time / TestEncodeMSM7ValidFrame

Function TestEncodeMSM7ValidFrame

rtcm/msm_encode_test.go:137–160  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

135
136func carrierPhaseCycles(gnss, sigID, freqID uint8, rangeM float64) float64 {
137 return rangeM / getWavelength(gnss, sigID, freqID)
138}
139
140func ghostObs(sv uint8) RawxObservation {
141 return RawxObservation{GnssID: GnssGPS, SvID: sv, SigID: 0, PrValid: true}
142}
143
144func TestEncodeMSM7ValidFrame(t *testing.T) {
145 const stationID, epochMs = uint16(7), uint32(288093000)
146 obs := []RawxObservation{
147 gpsObs(4, 20960834.6, carrierPhaseCycles(GnssGPS, 0, 0, 20960834.6), -3722.4, 43),
148 gpsObs(8, 18864369.0, carrierPhaseCycles(GnssGPS, 0, 0, 18864369.0), -1825.4, 49),
149 gpsObs(9, 19008414.2, carrierPhaseCycles(GnssGPS, 0, 0, 19008414.2), -2474.4, 45),
150 gpsObs(21, 23242403.8, carrierPhaseCycles(GnssGPS, 0, 0, 23242403.8), -1072.4, 40),
151 gpsObs(27, 21312585.2, carrierPhaseCycles(GnssGPS, 0, 0, 21312585.2), -3452.4, 42),
152 ghostObs(1), // timing-only track, must be excluded
153 }
154
155 frame, err := EncodeMSM7(stationID, GnssGPS, epochMs, obs)
156 require.NoError(t, err)
157
158 d := decodeMSM7(t, frame)
159 require.Equal(t, TypeGPSMSM7, d.msgType)
160 require.Equal(t, stationID, d.stationID)
161 require.Equal(t, epochMs, d.epoch)
162 require.False(t, d.multiple, "encoder leaves the multiple-message bit clear")
163 require.Equal(t, []int{4, 8, 9, 21, 27}, d.sats, "ghost SV1 excluded")

Callers

nothing calls this directly

Calls 5

gpsObsFunction · 0.85
ghostObsFunction · 0.85
EncodeMSM7Function · 0.85
decodeMSM7Function · 0.85
LenMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…