sized_queue_test.go 401 B

123456789101112131415161718
  1. package collect_test
  2. import (
  3. "testing"
  4. "github.com/v2ray/v2ray-core/common/collect"
  5. v2testing "github.com/v2ray/v2ray-core/testing"
  6. "github.com/v2ray/v2ray-core/testing/assert"
  7. )
  8. func TestSizedQueue(t *testing.T) {
  9. v2testing.Current(t)
  10. queue := collect.NewSizedQueue(2)
  11. assert.Pointer(queue.Put(1)).IsNil()
  12. assert.Pointer(queue.Put(2)).IsNil()
  13. assert.Int(queue.Put(3).(int)).Equals(1)
  14. }