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
|
||||
// to type out
|
||||
func buildPmtWithMeta(tstStr string) []byte {
|
||||
tmp := make([]byte, len(pmtWithMetaHead))
|
||||
copy(tmp, pmtWithMetaHead)
|
||||
pmt := append(tmp, tstStr...)
|
||||
pmt = append(pmt, pmtWithMetaTail...)
|
||||
return pmt
|
||||
dst := make([]byte, len(pmtWithMetaHead)+32+len(pmtWithMetaTail))
|
||||
copy(dst, pmtWithMetaHead)
|
||||
copy(dst[len(pmtWithMetaHead):], tstStr)
|
||||
copy(dst[len(pmtWithMetaHead)+32:], pmtWithMetaTail)
|
||||
return dst
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue