Commit 3f67d565 authored by wangwx's avatar wangwx

fix fmt error

parent 2298844a
......@@ -199,11 +199,11 @@ func (d *poolDequeue) PopTail() (interface{}, bool) {
}
func NewPoolDequeue(n int) (*poolDequeue, error) {
if n & (n - 1) != 0{
if n&(n-1) != 0 {
return nil, errors.New("the size of pool must be a power of 2")
}
d := &poolDequeue{
vals: make([]eface, n),
}
return d, nil
}
\ No newline at end of file
}
......@@ -25,21 +25,21 @@ import (
"testing"
)
func TestCreatePoolDequeue(t *testing.T){
_ , err := NewPoolDequeue(15)
func TestCreatePoolDequeue(t *testing.T) {
_, err := NewPoolDequeue(15)
assert.EqualError(t, err, "the size of pool must be a power of 2")
_ , err = NewPoolDequeue(18)
_, err = NewPoolDequeue(18)
assert.EqualError(t, err, "the size of pool must be a power of 2")
_ , err = NewPoolDequeue(24)
_, err = NewPoolDequeue(24)
assert.EqualError(t, err, "the size of pool must be a power of 2")
_ , err = NewPoolDequeue(8)
_, err = NewPoolDequeue(8)
assert.NoError(t, err)
}
func TestPoolDequeue(t *testing.T) {
const P = 10
var N int = 2e6
d , err := NewPoolDequeue(16)
if err != nil{
d, err := NewPoolDequeue(16)
if err != nil {
t.Errorf("create poolDequeue fail")
}
if testing.Short() {
......@@ -112,4 +112,4 @@ func TestPoolDequeue(t *testing.T) {
if !testing.Short() && nPopHead == 0 {
t.Errorf("popHead never succeeded")
}
}
\ No newline at end of file
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment