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.

26 lines
429 B

  1. package coordinator
  2. import (
  3. "testing"
  4. "github.com/stretchr/testify/assert"
  5. )
  6. func TestBatchQueue(t *testing.T) {
  7. bq := BatchQueue{}
  8. bq.Push(&BatchInfo{
  9. batchNum: 0,
  10. })
  11. bq.Push(&BatchInfo{
  12. batchNum: 2,
  13. })
  14. bq.Push(&BatchInfo{
  15. batchNum: 1,
  16. })
  17. assert.Equal(t, uint64(0), bq.Pop().batchNum)
  18. assert.Equal(t, uint64(2), bq.Pop().batchNum)
  19. assert.Equal(t, uint64(1), bq.Pop().batchNum)
  20. assert.Nil(t, bq.Pop())
  21. }