public function testCompare() { $q = new MinPriorityQueue(); $this->assertEquals(0, $q->compare(1, 1)); $this->assertEquals(-1, $q->compare(1, 0)); $this->assertEquals(1, $q->compare(0, 1)); }
/** * Try to enforce the eviction. * @todo Locking mechanism, so that a subsequent push() for the same key won't set the prio to a higher value * @param $offset */ private function markForEviction($offset) { $this->queue->insert($offset, 0); $this->priority->offsetSet($offset, 0); }