Closed msusol closed 8 years ago
Hi @msusol
I think your problem is related to #7 I've pushed a potential fix in master and improved concurrnet insertion testing. Could you test if it fixes your problem too?
Cheers
No replies from issue creator. Closing.
I was using your repository for a Median Maintenance algorithm using two Priority Queues: One supports Max, one supports Min. Your library is perfect, it seemed, for this.
But here is what happens in a simple case:
hLow := NewPQueue(lane.MAXPQ) hLow.Push("1",1) hLow.Push("2",2) hLow.Push("3",3) hLow.Push("4",4) // Pop order at this point: 3/3 4/4 2/2 1/1 v,p := hLow.Pop() // should be 4/4 -> get 3/3 hLow.Push("4",4) // resulting Pop order: 4/4 4/4 2/2 1/1
and I can break your Unit Test just by adding a 4th element in the queue:
func TestMaxPQueuePush_protects_max_order(t *testing.T) { pqueue := NewPQueue(MAXPQ)
}
--- FAIL: TestMaxPQueuePush_protects_max_order (0.00 seconds) Location: pqueue_test.go:38 Error: Not equal: "3" (expected) != "4" (actual)