* chore: execute goimports to format the code Signed-off-by: promalert <promalert@outlook.com> * goimports -w . --------- Signed-off-by: promalert <promalert@outlook.com> Co-authored-by: Chris Lu <chris.lu@gmail.com>
24 lines
278 B
Go
24 lines
278 B
Go
package util
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestNewQueue(t *testing.T) {
|
|
|
|
q := NewQueue[int]()
|
|
|
|
for i := 0; i < 10; i++ {
|
|
q.Enqueue(i)
|
|
}
|
|
|
|
assert.Equal(t, q.Len(), 10)
|
|
|
|
for i := 0; i < 10; i++ {
|
|
assert.Equal(t, q.Dequeue(), i)
|
|
}
|
|
|
|
}
|