mediamtx/internal/rtmp/bytecounter/writer_test.go

19 lines
276 B
Go
Raw Normal View History

2022-06-10 22:31:43 +00:00
package bytecounter
import (
"bytes"
"testing"
"github.com/stretchr/testify/require"
)
func TestWriter(t *testing.T) {
var buf bytes.Buffer
2022-07-16 10:42:48 +00:00
2022-06-10 22:31:43 +00:00
w := NewWriter(&buf)
2022-07-16 10:42:48 +00:00
w.SetCount(100)
2022-06-10 22:31:43 +00:00
w.Write(bytes.Repeat([]byte{0x01}, 64))
require.Equal(t, uint64(100+64), w.Count())
2022-06-10 22:31:43 +00:00
}