Ejemplo n.º 1
0
 public function testSortedIndex()
 {
     // from js
     $numbers = array(10, 20, 30, 40, 50);
     $num = 35;
     $index = __::sortedIndex($numbers, $num);
     $this->assertEquals(3, $index, '35 should be inserted at index 3');
     // extra
     $this->assertEquals(3, __($numbers)->sortedIndex(35), '35 should be inserted at index 3 with OO-style call');
     // docs
     $this->assertEquals(3, __::sortedIndex(array(10, 20, 30, 40), 35));
 }