Files
go-worm/lib/mic/chunk_test.go
T

21 lines
483 B
Go
Raw Normal View History

2026-09-02 01:00:09 +03:00
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])
}
}