Exemplo n.º 1
0
 /**
  * This method returns the value as an IInteger. Note: Using this method may result in
  * lost of precision.
  *
  * @access public
  * @static
  * @param ITrit\Type $x                                     the object to be converted
  * @return IInteger\Type                                    the value as an IInteger
  */
 public static function toInteger(ITrit\Type $x) : IInteger\Type
 {
     return IInteger\Type::make($x->unbox());
 }
Exemplo n.º 2
0
 /**
  * This method tests the "isOdd" method.
  *
  * @dataProvider data_isOdd
  */
 public function test_isOdd(array $provided, array $expected)
 {
     $this->markTestIncomplete();
     $p0 = IInteger\Module::isOdd(IInteger\Type::box($provided[0]));
     $e0 = $expected[0];
     $this->assertInstanceOf('\\Saber\\Data\\IBool\\Type', $p0);
     $this->assertSame($e0, $p0->unbox());
 }
Exemplo n.º 3
0
 /**
  * This method evaluates whether the operand is an odd number.
  *
  * @access public
  * @static
  * @param IInteger\Type $x                                  the object to be evaluated
  * @return IBool\Type                                       whether the operand is an odd
  *                                                          number
  */
 public static function isOdd(IInteger\Type $x) : IBool\Type
 {
     return IBool\Type::box(gmp_strval(gmp_div_r($x->unbox(), '2')) != '0');
 }
Exemplo n.º 4
0
 /**
  * This method tests the "toString" method.
  *
  * @dataProvider data_toString
  */
 public function test_toString(array $provided, array $expected)
 {
     $p0 = IInteger\Type::box($provided[0])->toString();
     $e0 = $expected[0];
     $this->assertInstanceOf('\\Saber\\Data\\IString\\Type', $p0);
     $this->assertSame($e0, $p0->unbox());
 }