From 44811a9f7bc84a642fd5805c964deb1ee7d134c5 Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Mon, 24 Aug 2020 17:32:23 +0100 Subject: initial heap based pq --- queue/queue_test.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'queue/queue_test.go') 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) -- cgit v1.2.3