aboutsummaryrefslogtreecommitdiffstats
path: root/pkg/fuzzer/queue/prio_queue_test.go
blob: 76d4b836b78aa64f0d71f541d621512220574e0e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// Copyright 2024 syzkaller project authors. All rights reserved.
// Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file.

package queue

import (
	"testing"

	"github.com/stretchr/testify/assert"
)

func TestPrioQueueOrder(t *testing.T) {
	pq := priorityQueueOps[int]{}
	pq.Push(1, 1)
	pq.Push(3, 3)
	pq.Push(2, 2)

	assert.Equal(t, 1, pq.Pop())
	assert.Equal(t, 2, pq.Pop())
	assert.Equal(t, 3, pq.Pop())
	assert.Zero(t, pq.Pop())
	assert.Zero(t, pq.Len())
}