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.

27 lines
503 B

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