1
0
Fork 0
mirror of https://github.com/chrislusf/seaweedfs synced 2024-07-05 16:47:04 +02:00
seaweedfs/go/stats/duration_counter_test.go
2015-04-20 22:05:20 +08:00

20 lines
256 B
Go

package stats
import "testing"
func TestRobinCounter(t *testing.T) {
rrc := NewRoundRobinCounter(60)
rrc.Add(0, 1)
rrc.Add(50, 2)
if rrc.Count() != 2 {
t.Fatal()
}
if rrc.Sum() != 3 {
t.Fatal()
}
/*
index out of range
*/
rrc.Add(61, 1)
}