mirror of https://bitbucket.org/ausocean/av.git
psi/psi_test.go: made buildPmtWithMeta() safer and readable
This commit is contained in:
parent
a24e4ecb81
commit
67d952c6a7
|
@ -367,9 +367,9 @@ func TestTrim(t *testing.T) {
|
||||||
// for pmts with time and location, as the location data field is 32 bytes, i.e. quite large
|
// for pmts with time and location, as the location data field is 32 bytes, i.e. quite large
|
||||||
// to type out
|
// to type out
|
||||||
func buildPmtWithMeta(tstStr string) []byte {
|
func buildPmtWithMeta(tstStr string) []byte {
|
||||||
tmp := make([]byte, len(pmtWithMetaHead))
|
dst := make([]byte, len(pmtWithMetaHead)+32+len(pmtWithMetaTail))
|
||||||
copy(tmp, pmtWithMetaHead)
|
copy(dst, pmtWithMetaHead)
|
||||||
pmt := append(tmp, tstStr...)
|
copy(dst[len(pmtWithMetaHead):], tstStr)
|
||||||
pmt = append(pmt, pmtWithMetaTail...)
|
copy(dst[len(pmtWithMetaHead)+32:], pmtWithMetaTail)
|
||||||
return pmt
|
return dst
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue