mirror of https://bitbucket.org/ausocean/av.git
psi/psi_test.go: got rid of bytes declaration for location strigns
This commit is contained in:
parent
1a966e8f9b
commit
b69c990b21
|
@ -124,19 +124,8 @@ const (
|
|||
// GPS string for testing
|
||||
// TODO: make these realistic
|
||||
var (
|
||||
locationBytes1 = [LocationDataSize]byte{
|
||||
0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
|
||||
0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
|
||||
0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
|
||||
0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
|
||||
}
|
||||
|
||||
locationBytes2 = [LocationDataSize]byte{
|
||||
0x08, 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01,
|
||||
0x08, 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01,
|
||||
0x08, 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01,
|
||||
0x08, 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01,
|
||||
}
|
||||
locationTstStr1 = []byte("$GPGGA,123519,4807.038,N,01131.0")
|
||||
locationTstStr2 = []byte("$GPGGA,183710,4902.048,N,02171.0")
|
||||
)
|
||||
|
||||
// err message
|
||||
|
@ -186,10 +175,10 @@ var (
|
|||
}
|
||||
|
||||
// Bytes representing pmt with time1 and location1
|
||||
pmtWithMetaTst1 = buildPmtWithMeta(locationBytes1[:])
|
||||
pmtWithMetaTst1 = buildPmtWithMeta(locationTstStr1)
|
||||
|
||||
// bytes representing pmt with with time1 and location 2
|
||||
pmtWithMetaTst2 = buildPmtWithMeta(locationBytes2[:])
|
||||
pmtWithMetaTst2 = buildPmtWithMeta(locationTstStr2)
|
||||
)
|
||||
|
||||
// bytesTests contains data for testing the Bytes() funcs for the PSI data struct
|
||||
|
@ -273,7 +262,7 @@ var bytesTests = []struct {
|
|||
{
|
||||
Dt: LocationDescTag,
|
||||
Dl: LocationDataSize,
|
||||
Dd: locationBytes1[:],
|
||||
Dd: locationTstStr1,
|
||||
},
|
||||
},
|
||||
Essd: &ESSD{
|
||||
|
@ -284,7 +273,7 @@ var bytesTests = []struct {
|
|||
},
|
||||
},
|
||||
},
|
||||
want: buildPmtWithMeta(locationBytes1[:]),
|
||||
want: buildPmtWithMeta(locationTstStr1),
|
||||
},
|
||||
}
|
||||
|
||||
|
@ -337,16 +326,16 @@ func TestTimeGet(t *testing.T) {
|
|||
// TestLocationGet checks that we can correctly get location data from a pmt table
|
||||
func TestLocationGet(t *testing.T) {
|
||||
pb := standardPmtWithMeta.Bytes()
|
||||
err := UpdateLocation(pb, string(locationBytes1[:]))
|
||||
err := UpdateLocation(pb, string(locationTstStr1))
|
||||
if err != nil {
|
||||
t.Errorf("Error for TestLocationGet UpdateLocation(pb, locationBytes1): %v", err)
|
||||
t.Errorf("Error for TestLocationGet UpdateLocation(pb, locationTstStr1): %v", err)
|
||||
}
|
||||
g, err := LocationFrom(pb)
|
||||
if err != nil {
|
||||
t.Errorf("Error for TestLocationGet LocationOf(pb): %v", err)
|
||||
}
|
||||
if g != string(locationBytes1[:]) {
|
||||
t.Errorf(errCmp, "TestLocationGet", locationBytes1, g)
|
||||
if g != string(locationTstStr1) {
|
||||
t.Errorf(errCmp, "TestLocationGet", locationTstStr1, g)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -355,7 +344,7 @@ func TestLocationUpdate(t *testing.T) {
|
|||
cpy := make([]byte, len(pmtWithMetaTst1))
|
||||
copy(cpy, pmtWithMetaTst1)
|
||||
cpy = addCrc(cpy)
|
||||
err := UpdateLocation(cpy, string(locationBytes2[:]))
|
||||
err := UpdateLocation(cpy, string(locationTstStr2))
|
||||
cpy = cpy[:len(cpy)-4]
|
||||
if err != nil {
|
||||
t.Errorf("Update time returned err: %v", err)
|
||||
|
|
Loading…
Reference in New Issue