소스 검색

more test case for buffer

v2ray 9 년 전
부모
커밋
7385c05f29
1개의 변경된 파일17개의 추가작업 그리고 0개의 파일을 삭제
  1. 17 0
      transport/internet/kcp/buffer_test.go

+ 17 - 0
transport/internet/kcp/buffer_test.go

@@ -20,3 +20,20 @@ func TestBuffer(t *testing.T) {
 	assert.Pointer(b.Allocate()).IsNil()
 	b.Release()
 }
+
+func TestSingleRelease(t *testing.T) {
+	assert := assert.On(t)
+
+	b := NewBuffer()
+	x := b.Allocate()
+	x.Release()
+
+	y := b.Allocate()
+	assert.Pointer(y.Value).IsNotNil()
+
+	b.Release()
+	y.Release()
+
+	z := b.Allocate()
+	assert.Pointer(z).IsNil()
+}