예제 #1
0
 /**
  * Tests whether next returns indeed the next token and shifts the pointer; or returns false is there is no next.
  *
  * @return void
  */
 public function testNext()
 {
     $this->assertEquals(false, $this->fixture->seek(11));
     $this->assertEquals(false, $this->fixture->next());
     $this->assertEquals(9, $this->fixture->seek(8));
     $this->assertEquals(10, $this->fixture->next());
     $this->assertEquals(false, $this->fixture->next());
     // out of bounds
 }
예제 #2
0
 /**
  * Tests whether next returns indeed the next token and shifts the pointer; or returns false is there is no next.
  *
  * @return void
  */
 public function testNext()
 {
     $this->assertEquals(false, $this->fixture->seek(11));
     $this->assertEquals(false, $this->fixture->next());
     $this->assertEquals(9, $this->fixture->seek(8));
     $this->assertEquals(10, $this->fixture->next());
     $this->assertEquals(false, $this->fixture->next());
     // out of bounds
     $fixture2 = new DocBlox_BidirectionalIterator(array_fill(0, 1000, 'a'));
     $times = array();
     for ($i = 0; $i < 1000; $i++) {
         $time = microtime(true);
         $fixture2->next();
         $times[] = microtime(true) - $time;
     }
     $average = array_sum($times) / count($times);
     $this->assertLessThan(0.0002, $average);
 }