diff --git a/stream/mts/psi/psi_test.go b/stream/mts/psi/psi_test.go index 0c189021..3d3a74a7 100644 --- a/stream/mts/psi/psi_test.go +++ b/stream/mts/psi/psi_test.go @@ -193,7 +193,7 @@ var bytesTests = []struct { } // 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) { for _, test := range bytesTests { 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) { tb := TimeBytes(tstTime1) 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) { cpy := make([]byte, len(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) { s, err := TimeOf(pmtTimeBytes1) 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) { cpy := make([]byte, len(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 { return append(append(append(make([]byte, 0), pmtTimeGpsBytesPart1...), GpsStrBytes(tstStr)...), pmtTimeGpsBytesPart2...)