Tests for priority queue with a fix

I've added a few tests for priority queue. It's demonstrated a failure which I fixed in this pull-request.