diff options
Diffstat (limited to 'queue/queue_test.go')
| -rw-r--r-- | queue/queue_test.go | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/queue/queue_test.go b/queue/queue_test.go index 3130b42..e3c37b8 100644 --- a/queue/queue_test.go +++ b/queue/queue_test.go @@ -12,17 +12,17 @@ const maxLength int = 10000 const factor int = 100 // Store results here to avoid compiler optimizations -var benchResult ds.ArrayList +var benchResult ds.ArrayList[int] func TestElementaryPriority(t *testing.T) { - q := NewElementaryPriority(1) + q := NewElementaryPriority[int](1) for i := minLength; i <= maxLength; i *= factor { test(q, i, t) } } func TestHeapPriority(t *testing.T) { - q := NewHeapPriority(1) + q := NewHeapPriority[int](1) for i := minLength; i <= maxLength; i *= factor { test(q, i, t) } @@ -30,7 +30,7 @@ func TestHeapPriority(t *testing.T) { func test(q PriorityQueue, l int, t *testing.T) { cb := func(t *testing.T) { - for _, a := range ds.NewRandomArrayList(l, -1) { + for _, a := range ds.NewRandomArrayList[int](l, -1) { q.Insert(a) } prev, started := 0, false @@ -53,21 +53,21 @@ func test(q PriorityQueue, l int, t *testing.T) { } func BenchmarkElementaryPriority(b *testing.B) { - q := NewElementaryPriority(1) + q := NewElementaryPriority[int](1) for i := minLength; i <= maxLength; i *= factor { benchmark(q, i, b) } } func BenchmarkHeapPriority(b *testing.B) { - q := NewHeapPriority(1) + q := NewHeapPriority[int](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) + benchResult = ds.NewRandomArrayList[int](l, -1) b.Run(fmt.Sprintf("randomInsert(%d)", l), func(b *testing.B) { for i := 0; i < b.N; i++ { |
