Beispiel #1
0
 public function getInstance(array $values = [])
 {
     $queue = new \Ds\PriorityQueue();
     foreach ($values as $value => $priority) {
         $queue->push($value, $priority);
     }
     return $queue;
 }
Beispiel #2
0
 /**
  * @dataProvider pushDataProvider
  */
 public function testPushAllFromPriorityQueue(array $values, array $expected)
 {
     $instance = $this->getInstance();
     $queue = new \Ds\PriorityQueue();
     foreach ($values as $value) {
         $queue->push($value, 0);
     }
     $instance->pushAll($queue);
     $this->assertToArray($expected, $instance);
     $this->assertCount(0, $queue);
 }