You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

19 lines
256 B

  1. package stats
  2. import "testing"
  3. func TestRobinCounter(t *testing.T) {
  4. rrc := NewRoundRobinCounter(60)
  5. rrc.Add(0, 1)
  6. rrc.Add(50, 2)
  7. if rrc.Count() != 2 {
  8. t.Fatal()
  9. }
  10. if rrc.Sum() != 3 {
  11. t.Fatal()
  12. }
  13. /*
  14. index out of range
  15. */
  16. rrc.Add(61, 1)
  17. }