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

  1. package util
  2. import "testing"
  3. func TestEnqueueAndConsume(t *testing.T) {
  4. q := NewUnboundedQueue()
  5. q.EnQueue("1", "2", "3")
  6. f := func(items []string) {
  7. for _, t := range items {
  8. println(t)
  9. }
  10. println("-----------------------")
  11. }
  12. q.Consume(f)
  13. q.Consume(f)
  14. q.EnQueue("4", "5")
  15. q.EnQueue("6", "7")
  16. q.Consume(f)
  17. }