Ejemplo 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());
 }
Ejemplo n.º 2
0
 /**
  * This method tests the "make" method.
  *
  * @dataProvider data_make
  */
 public function test_make(array $provided, array $expected)
 {
     $p0 = IInteger\Type::make($provided[0]);
     $this->assertInstanceOf('\\Saber\\Data\\IInteger\\Type', $p0);
     $p1 = $p0->unbox();
     $e1 = $expected[0];
     $this->assertInternalType('string', $p1);
     $this->assertRegExp('/^[+-]?(0|([1-9][0-9]*))$/', $p1);
     $this->assertSame($e1, $p1);
 }