From 559eadcaf17df6c6698ba317946d736453a6c240 Mon Sep 17 00:00:00 2001 From: v2ray Date: Mon, 11 Jan 2016 23:04:24 +0100 Subject: [PATCH] test case for sized queue --- common/collect/sized_queue_test.go | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 common/collect/sized_queue_test.go diff --git a/common/collect/sized_queue_test.go b/common/collect/sized_queue_test.go new file mode 100644 index 00000000..2456095f --- /dev/null +++ b/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) +}