UPdated local with remote

Merge branch 'improve-ts-encoder-performance' of http://bitbucket.org/ausocean/av into improve-ts-encoder-performance
This commit is contained in:
saxon 2019-01-03 12:48:46 +10:30
commit 3e5b575df0
1 changed files with 8 additions and 8 deletions

View File

@ -91,10 +91,10 @@ var (
}
// Bytes representing pmt with time1 and location1
pmtTimeLocBytes1 = buildPmtTimeLocBytes(locationTstStr1)
pmtTimeLocationBytes1 = buildPmtTimeLocationBytes(locationTstStr1)
// bytes representing pmt with with time1 and location 2
pmtTimeLocBytes2 = buildPmtTimeLocBytes(locationTstStr2)
pmtTimeLocationBytes2 = buildPmtTimeLocationBytes(locationTstStr2)
)
// bytesTests contains data for testing the Bytes() funcs for the PSI data struct
@ -189,7 +189,7 @@ var bytesTests = []struct {
},
},
},
want: buildPmtTimeLocBytes(locationTstStr1),
want: buildPmtTimeLocationBytes(locationTstStr1),
},
}
@ -257,23 +257,23 @@ func TestLocationGet(t *testing.T) {
// TestLocationUpdate checks to see if we can update the location string in a pmt correctly
func TestLocationUpdate(t *testing.T) {
cpy := make([]byte, len(pmtTimeLocBytes1))
copy(cpy, pmtTimeLocBytes1)
cpy := make([]byte, len(pmtTimeLocationBytes1))
copy(cpy, pmtTimeLocationBytes1)
cpy = addCrc(cpy)
err := UpdateLocation(cpy, locationTstStr2)
cpy = cpy[:len(cpy)-4]
if err != nil {
t.Errorf("Update time returned err: %v", err)
}
if !bytes.Equal(pmtTimeLocBytes2, cpy) {
t.Errorf(errCmp, "TestLocationUpdate", pmtTimeLocBytes2, cpy)
if !bytes.Equal(pmtTimeLocationBytes2, cpy) {
t.Errorf(errCmp, "TestLocationUpdate", pmtTimeLocationBytes2, cpy)
}
}
// buildPmtTimeLocationBytes is a helper function to help construct the byte slices
// for pmts with time and location, as the location data field is 32 bytes, i.e. quite large
// to type out
func buildPmtTimeLocBytes(tstStr string) []byte {
func buildPmtTimeLocationBytes(tstStr string) []byte {
return append(append(append(make([]byte, 0), pmtTimeLocationBytesPart1...),
LocationStrBytes(tstStr)...), pmtTimeLocationBytesPart2...)
}