github.com/google/syzkaller@v0.0.0-20240517125934-c0f1611a36d6/pkg/fuzzer/queue/prio_queue_test.go (about)

     1  // Copyright 2024 syzkaller project authors. All rights reserved.
     2  // Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file.
     3  
     4  package queue
     5  
     6  import (
     7  	"testing"
     8  
     9  	"github.com/stretchr/testify/assert"
    10  )
    11  
    12  func TestPrioQueueOrder(t *testing.T) {
    13  	pq := priorityQueueOps[int]{}
    14  	pq.Push(1, 1)
    15  	pq.Push(3, 3)
    16  	pq.Push(2, 2)
    17  
    18  	assert.Equal(t, 1, pq.Pop())
    19  	assert.Equal(t, 2, pq.Pop())
    20  	assert.Equal(t, 3, pq.Pop())
    21  	assert.Zero(t, pq.Pop())
    22  	assert.Zero(t, pq.Len())
    23  }