Audio
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
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])
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user