Exemplo n.º 1
0
 public function getInstance(array $values = [])
 {
     $queue = new \Ds\PriorityQueue();
     foreach ($values as $value => $priority) {
         $queue->push($value, $priority);
     }
     return $queue;
 }
Exemplo n.º 2
0
Arquivo: pushAll.php Projeto: Driky/ds
 /**
  * @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);
 }