Explorar o código

test case for sized queue

v2ray %!s(int64=9) %!d(string=hai) anos
pai
achega
559eadcaf1
Modificáronse 1 ficheiros con 18 adicións e 0 borrados
  1. 18 0
      common/collect/sized_queue_test.go

+ 18 - 0
common/collect/sized_queue_test.go

@@ -0,0 +1,18 @@
+package collect_test
+
+import (
+	"testing"
+
+	"github.com/v2ray/v2ray-core/common/collect"
+	v2testing "github.com/v2ray/v2ray-core/testing"
+	"github.com/v2ray/v2ray-core/testing/assert"
+)
+
+func TestSizedQueue(t *testing.T) {
+	v2testing.Current(t)
+
+	queue := collect.NewSizedQueue(2)
+	assert.Pointer(queue.Put(1)).IsNil()
+	assert.Pointer(queue.Put(2)).IsNil()
+	assert.Int(queue.Put(3).(int)).Equals(1)
+}