1
Fork 0
mirror of https://github.com/jech/galene.git synced 2024-11-08 17:55:59 +01:00
galene/jitter/jitter_test.go
2020-05-03 11:06:08 +02:00

37 lines
635 B
Go

package jitter
import (
"testing"
)
func TestJitter(t *testing.T) {
e := New(48000)
e.accumulate(0, 0)
e.accumulate(1000, 1000)
e.accumulate(2000, 2000)
e.accumulate(3000, 3000)
if e.Jitter() != 0 {
t.Errorf("Expected 0, got %v", e.Jitter())
}
e = New(48000)
e.accumulate(0, 0)
e.accumulate(1000, 1000)
e.accumulate(2000, 2200)
e.accumulate(3000, 3000)
if e.Jitter() != 23 {
t.Errorf("Expected 23, got %v", e.Jitter())
}
e = New(48000)
e.accumulate(0, 0)
e.accumulate(1000, 1000)
e.accumulate(2000, 1800)
e.accumulate(3000, 3000)
if e.Jitter() != 23 {
t.Errorf("Expected 23, got %v", e.Jitter())
}
}