21 lines
483 B
Go
21 lines
483 B
Go
package mic
|
|
|
|
import (
|
|
"bytes"
|
|
"testing"
|
|
)
|
|
|
|
func TestAppendChunkPCMCaps(t *testing.T) {
|
|
t.Parallel()
|
|
half := maxChunkPCM / 2
|
|
buf := appendChunkPCM(nil, bytes.Repeat([]byte{1}, half))
|
|
buf = appendChunkPCM(buf, bytes.Repeat([]byte{2}, half))
|
|
buf = appendChunkPCM(buf, bytes.Repeat([]byte{3}, half))
|
|
if len(buf) != maxChunkPCM {
|
|
t.Fatalf("len = %d, want %d", len(buf), maxChunkPCM)
|
|
}
|
|
if buf[0] != 2 {
|
|
t.Fatalf("first byte = %d, want 2 (oldest chunk dropped)", buf[0])
|
|
}
|
|
}
|