mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-12-15 02:59:06 +08:00
26 lines
334 B
Go
26 lines
334 B
Go
package util
|
|
|
|
import "testing"
|
|
|
|
func TestEnqueueAndConsume(t *testing.T) {
|
|
|
|
q := NewUnboundedQueue()
|
|
|
|
q.EnQueue("1", "2", "3")
|
|
|
|
f := func(items []string) {
|
|
for _, t := range items {
|
|
println(t)
|
|
}
|
|
println("-----------------------")
|
|
}
|
|
q.Consume(f)
|
|
|
|
q.Consume(f)
|
|
|
|
q.EnQueue("4", "5")
|
|
q.EnQueue("6", "7")
|
|
q.Consume(f)
|
|
|
|
}
|