Renaming: Acquire->Get, Release->Put for the sake of the consistency with standard package

This commit is contained in:
Aliaksandr Valialkin
2016-06-24 14:57:35 +03:00
parent 5dec51fcf9
commit 928aed2629
5 changed files with 42 additions and 30 deletions
+8 -8
View File
@@ -36,7 +36,7 @@ func TestPoolCalibrate(t *testing.T) {
if i%15 == 0 {
n = rand.Intn(15234)
}
testAcquireRelease(t, n)
testGetPut(t, n)
}
}
@@ -66,23 +66,23 @@ func testPoolVariousSizes(t *testing.T) {
for i := 0; i < steps+1; i++ {
n := (1 << uint32(i))
testAcquireRelease(t, n)
testAcquireRelease(t, n+1)
testAcquireRelease(t, n-1)
testGetPut(t, n)
testGetPut(t, n+1)
testGetPut(t, n-1)
for j := 0; j < 10; j++ {
testAcquireRelease(t, j+n)
testGetPut(t, j+n)
}
}
}
func testAcquireRelease(t *testing.T, n int) {
bb := Acquire()
func testGetPut(t *testing.T, n int) {
bb := Get()
if len(bb.B) > 0 {
t.Fatalf("non-empty byte buffer returned from acquire")
}
bb.B = allocNBytes(bb.B, n)
Release(bb)
Put(bb)
}
func allocNBytes(dst []byte, n int) []byte {