Commit cc012e40 authored by Dirk McCormick's avatar Dirk McCormick

fix: Peek() test

parent 6c34ec60
...@@ -53,10 +53,11 @@ func TestCorrectnessOfPop(t *testing.T) { ...@@ -53,10 +53,11 @@ func TestCorrectnessOfPop(t *testing.T) {
var priorities []int var priorities []int
var peekPriorities []int var peekPriorities []int
for q.Len() > 0 { for q.Len() > 0 {
i := q.Pop().(*TestElem).Priority i := q.Peek().(*TestElem).Priority
t.Logf("popped %v", i)
priorities = append(priorities, i)
peekPriorities = append(peekPriorities, i) peekPriorities = append(peekPriorities, i)
j := q.Pop().(*TestElem).Priority
t.Logf("popped %v", j)
priorities = append(priorities, j)
} }
if !sort.IntsAreSorted(peekPriorities) { if !sort.IntsAreSorted(peekPriorities) {
t.Fatal("the values were not returned in sorted order") t.Fatal("the values were not returned in sorted order")
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment