Exemple #1
0
 /**
  * This method computes the nth fibonacci number.
  *
  * @access public
  * @static
  * @param IInt32\Type $n                                    the operand
  * @return IInt32\Type                                      the result
  */
 public static function fibonacci(IInt32\Type $n) : IInt32\Type
 {
     return IInt32\Module::le($n, IInt32\Type::one())->unbox() ? $n : IInt32\Module::add(IInt32\Module::fibonacci(IInt32\Module::decrement($n)), IInt32\Module::fibonacci(IInt32\Module::subtract($n, IInt32\Type::box(2))));
 }
 /**
  * This method tests the "le" method.
  *
  * @dataProvider data_le
  */
 public function test_le(array $provided, array $expected)
 {
     $p0 = IInt32\Module::le(IInt32\Type::box($provided[0]), IInt32\Type::box($provided[1]));
     $e0 = $expected[0];
     $this->assertInstanceOf('\\Saber\\Data\\IBool\\Type', $p0);
     $this->assertSame($e0, $p0->unbox());
 }