示例#1
0
function randomTest($N, $k)
{
    $es = array();
    $a = array();
    for ($i = 0; $i < $k; $i++) {
        $a[$i] = rand(0, $N);
    }
    $t1 = microtime(true);
    $q = new QuickSort($a);
    $q->sort();
    return array('time' => microtime(true) - $t1, 'swaps' => $q->getSwaps(), 'compares' => $q->getCompares());
}
示例#2
0
 /**
  * @test
  */
 public function testGetCompares()
 {
     $a = array(10, 10);
     $q = new QuickSort($a);
     $q->getCompares();
 }