Example #1
0
 /**
  * @covers h4kuna\Math::interval
  * @todo   Implement testInterval().
  */
 public function testInterval()
 {
     $this->assertSame(1, Math::interval(1, 2));
     $this->assertSame(1, Math::interval(1, 1));
     $this->assertSame(0, Math::interval(1, 0));
     $this->assertSame(2, Math::interval(2, 4, 1));
     $this->assertSame(2, Math::interval(2, 4, 2));
     $this->assertSame(3, Math::interval(2, 4, 3));
     $this->assertSame(-5, Math::interval(-5, -4, -6));
     $this->setExpectedException('h4kuna\\DataType\\InvalidArgumentsException');
     Math::interval(2, 1, 3);
 }
Example #2
0
 /**
  * nastavi vnitrni ukazatel
  * @param int unsigned $pointer
  * @return int
  * @throw \OutOfBoundsException
  */
 public function setPointer($pointer, $interval = TRUE)
 {
     $pointer = (int) $pointer;
     if ($interval) {
         $pointer = (int) Math::interval($pointer, self::POINTER, $this->last());
     }
     $this->seek($pointer);
     return $this;
 }