Esempio n. 1
0
 /**
  * Tests Range::setInclusive()
  */
 public function testSetInclusive()
 {
     $range = new index\Range(0, 0);
     $range->setInclusive(true);
     $this->assertTrue($range->isInclusive());
     $range = new index\Range(0, 0);
     $range->setInclusive(false);
     $this->assertFalse($range->isInclusive());
 }
Esempio n. 2
0
 /**
  * @dataProvider provideTestAllValidRanges
  */
 public function testAllValidRanges(IndexGenerator $generator)
 {
     $index = $generator->getIndex();
     for ($length = 0; $length <= $generator->getIndexLength(); $length++) {
         for ($min = $generator->getMinimum(); $min + $length <= $generator->getMaximum(); $min++) {
             $range = new index\Range($min, $min + $length);
             $range->setInclusive(true);
             $foundKeys = index\IteratorUtil::toKeysArray($index->searchRange($range));
             $expectedKeys = array();
             for ($key = $range->getMin(); $key <= $range->getMax(); $key++) {
                 $expectedKeys[] = $key;
             }
             $this->assertEquals($expectedKeys, $foundKeys, "failed range[{$range->getMin()}, {$range->getMax()}] for index[{$generator->getMinimum()}, {$generator->getMaximum()}]");
         }
     }
 }