queue_test.go 277 B

12345678910111213141516171819202122
  1. package util
  2. import (
  3. "github.com/stretchr/testify/assert"
  4. "testing"
  5. )
  6. func TestNewQueue(t *testing.T) {
  7. q := NewQueue[int]()
  8. for i := 0; i < 10; i++ {
  9. q.Enqueue(i)
  10. }
  11. assert.Equal(t, q.Len(), 10)
  12. for i := 0; i < 10; i++ {
  13. assert.Equal(t, q.Dequeue(), i)
  14. }
  15. }