summaryrefslogtreecommitdiff
path: root/queue/queue_test.go
diff options
context:
space:
mode:
authorPaul Buetow <pbuetow@mimecast.com>2020-08-24 17:32:23 +0100
committerPaul Buetow <pbuetow@mimecast.com>2020-08-24 17:32:23 +0100
commit44811a9f7bc84a642fd5805c964deb1ee7d134c5 (patch)
tree6d1022d96562552d83c1a052042cbca6d211231f /queue/queue_test.go
parentc8f7879655125bcbf18f41897cf3f7e7385693aa (diff)
initial heap based pq
Diffstat (limited to 'queue/queue_test.go')
-rw-r--r--queue/queue_test.go14
1 files changed, 14 insertions, 0 deletions
diff --git a/queue/queue_test.go b/queue/queue_test.go
index 6be87be..25290f1 100644
--- a/queue/queue_test.go
+++ b/queue/queue_test.go
@@ -20,6 +20,13 @@ func TestElementaryPriority(t *testing.T) {
}
}
+func TestHeapPriority(t *testing.T) {
+ q := NewHeapPriority(1)
+ for i := minLength; i <= maxLength; i *= factor {
+ test(q, i, t)
+ }
+}
+
func test(q PriorityQueue, l int, t *testing.T) {
cb := func(t *testing.T) {
t.Parallel()
@@ -52,6 +59,13 @@ func BenchmarkElementaryPriority(b *testing.B) {
}
}
+func BenchmarkHeapPriority(b *testing.B) {
+ q := NewHeapPriority(1)
+ for i := minLength; i <= maxLength; i *= factor {
+ benchmark(q, i, b)
+ }
+}
+
func benchmark(q PriorityQueue, l int, b *testing.B) {
benchResult = ds.NewRandomArrayList(l, -1)