コード例 #1
0
ファイル: Module.php プロジェクト: bluesnowman/fphp-saber
 /**
  * This method returns the numerically lowest value.
  *
  * @access public
  * @static
  * @param IObject\Type $x                                   the left operand
  * @param IObject\Type $y                                   the right operand
  * @return IObject\Type                                     the minimum value
  */
 public static function min(IObject\Type $x, IObject\Type $y) : IObject\Type
 {
     return IObject\Module::compare($x, $y)->unbox() <= 0 ? $x : $y;
 }
コード例 #2
0
ファイル: ModuleTest.php プロジェクト: bluesnowman/fphp-saber
 /**
  * This method tests the "min" method.
  *
  * @dataProvider data_min
  */
 public function test_min(array $provided, array $expected)
 {
     $p0 = IObject\Module::min(IObject\Type::box($provided[0]), IObject\Type::box($provided[1]));
     $e0 = $expected[0];
     $this->assertInstanceOf('\\Saber\\Data\\IObject\\Type', $p0);
     $this->assertSame($e0, $p0->unbox());
 }