mirror of
https://github.com/aler9/gortsplib
synced 2025-10-05 23:26:54 +08:00
21 lines
352 B
Go
21 lines
352 B
Go
package bytecounter
|
|
|
|
import (
|
|
"bytes"
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/require"
|
|
)
|
|
|
|
func TestByteCounter(t *testing.T) {
|
|
bc := New(bytes.NewBuffer(nil), nil, nil)
|
|
|
|
bc.Write([]byte{0x01, 0x02, 0x03, 0x04})
|
|
|
|
buf := make([]byte, 2)
|
|
bc.Read(buf)
|
|
|
|
require.Equal(t, uint64(4), bc.BytesSent())
|
|
require.Equal(t, uint64(2), bc.BytesReceived())
|
|
}
|