mirror of https://bitbucket.org/ausocean/av.git
psi: added some commenting above testing funcs
This commit is contained in:
parent
f320746b5d
commit
41d98b4dcd
|
@ -193,7 +193,7 @@ var bytesTests = []struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
// TestBytes ensures that the Bytes() funcs are working correctly to take PSI
|
// TestBytes ensures that the Bytes() funcs are working correctly to take PSI
|
||||||
// structs and converting them to byte slices
|
// structs and convert them to byte slices
|
||||||
func TestBytes(t *testing.T) {
|
func TestBytes(t *testing.T) {
|
||||||
for _, test := range bytesTests {
|
for _, test := range bytesTests {
|
||||||
got := test.input.Bytes()
|
got := test.input.Bytes()
|
||||||
|
@ -206,7 +206,7 @@ func TestBytes(t *testing.T) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// A quick sanity check of the int64 time to []byte func
|
// TestTimestampToBytes is a quick sanity check of the int64 time to []byte func
|
||||||
func TestTimestampToBytes(t *testing.T) {
|
func TestTimestampToBytes(t *testing.T) {
|
||||||
tb := TimeBytes(tstTime1)
|
tb := TimeBytes(tstTime1)
|
||||||
if !bytes.Equal(timeSlice, tb) {
|
if !bytes.Equal(timeSlice, tb) {
|
||||||
|
@ -214,6 +214,7 @@ func TestTimestampToBytes(t *testing.T) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TestTimeUpdate checks to see if we can correctly update the timstamp in pmt
|
||||||
func TestTimeUpdate(t *testing.T) {
|
func TestTimeUpdate(t *testing.T) {
|
||||||
cpy := make([]byte, len(pmtTimeBytes1))
|
cpy := make([]byte, len(pmtTimeBytes1))
|
||||||
copy(cpy, pmtTimeBytes1)
|
copy(cpy, pmtTimeBytes1)
|
||||||
|
@ -226,6 +227,7 @@ func TestTimeUpdate(t *testing.T) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TestTimeGet tsts to see if we can correctly get the timestamp from a pmt
|
||||||
func TestTimeGet(t *testing.T) {
|
func TestTimeGet(t *testing.T) {
|
||||||
s, err := TimeOf(pmtTimeBytes1)
|
s, err := TimeOf(pmtTimeBytes1)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -236,6 +238,7 @@ func TestTimeGet(t *testing.T) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TestGpsUpdate checks to see if we can update the gps string in a pmt correctly
|
||||||
func TestGpsUpdate(t *testing.T) {
|
func TestGpsUpdate(t *testing.T) {
|
||||||
cpy := make([]byte, len(pmtTimeGpsBytes1))
|
cpy := make([]byte, len(pmtTimeGpsBytes1))
|
||||||
copy(cpy, pmtTimeGpsBytes1)
|
copy(cpy, pmtTimeGpsBytes1)
|
||||||
|
@ -248,6 +251,9 @@ func TestGpsUpdate(t *testing.T) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// buildPmtTimeGpsBytes is a helper function to help construct the byte slices
|
||||||
|
// for pmts with time and gps, as the gps data field is 32 bytes, i.e. quite large
|
||||||
|
// to type out
|
||||||
func buildPmtTimeGpsBytes(tstStr string) []byte {
|
func buildPmtTimeGpsBytes(tstStr string) []byte {
|
||||||
return append(append(append(make([]byte, 0), pmtTimeGpsBytesPart1...),
|
return append(append(append(make([]byte, 0), pmtTimeGpsBytesPart1...),
|
||||||
GpsStrBytes(tstStr)...), pmtTimeGpsBytesPart2...)
|
GpsStrBytes(tstStr)...), pmtTimeGpsBytesPart2...)
|
||||||
|
|
Loading…
Reference in New Issue