示例#1
0
 /**
  * This method tests the "isNegative" method.
  *
  * @dataProvider data_isNegative
  */
 public function test_isNegative(array $provided, array $expected)
 {
     $p0 = IInt32\Module::isNegative(IInt32\Type::box($provided[0]));
     $e0 = $expected[0];
     $this->assertInstanceOf('\\Saber\\Data\\IBool\\Type', $p0);
     $this->assertSame($e0, $p0->unbox());
 }
示例#2
0
 /**
  * This method returns whether the operand is a negative number.
  *
  * @access public
  * @static
  * @param IRatio\Type $x                                    the object to be evaluated
  * @return IBool\Type                                       whether the operand is a negative
  *                                                          number
  */
 public static function isNegative(IRatio\Type $x) : IBool\Type
 {
     $a = IInt32\Module::isNegative($x->numerator())->unbox();
     $b = IInt32\Module::isNegative($x->denominator())->unbox();
     return IBool\Type::box(($a || $b) && $a != $b);
 }