Add PriorityQueue unit test and fix a bug.