From cc012e407af10a353a1ee47d7337a0c3f7a397dd Mon Sep 17 00:00:00 2001 From: Dirk McCormick Date: Wed, 30 Oct 2019 16:16:23 -0400 Subject: [PATCH] fix: Peek() test --- pq_test.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/pq_test.go b/pq_test.go index d3f884a..f63911c 100644 --- a/pq_test.go +++ b/pq_test.go @@ -53,10 +53,11 @@ func TestCorrectnessOfPop(t *testing.T) { var priorities []int var peekPriorities []int for q.Len() > 0 { - i := q.Pop().(*TestElem).Priority - t.Logf("popped %v", i) - priorities = append(priorities, i) + i := q.Peek().(*TestElem).Priority peekPriorities = append(peekPriorities, i) + j := q.Pop().(*TestElem).Priority + t.Logf("popped %v", j) + priorities = append(priorities, j) } if !sort.IntsAreSorted(peekPriorities) { t.Fatal("the values were not returned in sorted order") -- GitLab