mirror of
https://github.com/bluenviron/mediamtx
synced 2025-01-10 00:39:28 +00:00
31 lines
536 B
Go
31 lines
536 B
Go
package chunk
|
|
|
|
import (
|
|
"bytes"
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/require"
|
|
)
|
|
|
|
var chunk3enc = []byte{
|
|
0xd9, 0x1, 0x2, 0x3, 0x4,
|
|
}
|
|
|
|
var chunk3dec = Chunk3{
|
|
ChunkStreamID: 25,
|
|
Body: []byte{0x01, 0x02, 0x03, 0x04},
|
|
}
|
|
|
|
func TestChunk3Read(t *testing.T) {
|
|
var chunk3 Chunk3
|
|
err := chunk3.Read(bytes.NewReader(chunk3enc), 4)
|
|
require.NoError(t, err)
|
|
require.Equal(t, chunk3dec, chunk3)
|
|
}
|
|
|
|
func TestChunk3Write(t *testing.T) {
|
|
buf, err := chunk3dec.Write()
|
|
require.NoError(t, err)
|
|
require.Equal(t, chunk3enc, buf)
|
|
}
|