예제 #1
0
 /**
  * This method returns the numerically lowest value.
  *
  * @access public
  * @static
  * @param IInteger\Type $x                                  the left operand
  * @param IInteger\Type $y                                  the right operand
  * @return IInteger\Type                                    the minimum value
  */
 public static function min(IInteger\Type $x, IInteger\Type $y) : IInteger\Type
 {
     return IInteger\Module::compare($x, $y)->unbox() <= 0 ? $x : $y;
 }
예제 #2
0
 /**
  * This method tests the "compare" method.
  *
  * @dataProvider data_compare
  */
 public function test_compare(array $provided, array $expected)
 {
     $p0 = IInteger\Module::compare(IInteger\Type::box($provided[0]), IInteger\Type::box($provided[1]));
     $e0 = $expected[0];
     $this->assertInstanceOf('\\Saber\\Data\\ITrit\\Type', $p0);
     $this->assertSame($e0, $p0->unbox());
 }