You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
334 B
25 lines
334 B
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)
|
|
|
|
}
|