Example #1
0
 /**
  * This method tests the "match" method.
  *
  * @dataProvider data_match
  */
 public function test_match(array $provided, array $expected)
 {
     $p0 = IRegex\Module::match(IRegex\Type::box($provided[0]), IObject\Type::box($provided[1]));
     $e0 = $expected[0];
     $this->assertInstanceOf('\\Saber\\Data\\IBool\\Type', $p0);
     $this->assertSame($e0, $p0->unbox());
 }
Example #2
0
 /**
  * This method tests the "replicate" method.
  *
  * @dataProvider data_replicate
  */
 public function test_replicate(array $provided, array $expected)
 {
     $p0 = ILinkedList\Type::replicate(IObject\Type::box($provided[0]), IInt32\Type::box($provided[1]));
     $e0 = $expected[0];
     $this->assertInstanceOf('\\Saber\\Data\\ILinkedList\\Type', $p0);
     $this->assertSame($e0, $p0->unbox(1));
 }
Example #3
0
 /**
  * This method tests the "make2" method.
  *
  * @dataProvider data_make2
  */
 public function test_make2(array $provided, array $expected)
 {
     $p0 = call_user_func_array(array('\\Saber\\Data\\ITuple\\Type', 'make2'), array_map(function ($item) {
         return IObject\Type::box($item);
     }, $provided[0]));
     $e0 = $expected[0];
     $this->assertInstanceOf('\\Saber\\Data\\ITuple\\Type', $p0);
     $this->assertSame($e0, $p0->unbox(1));
 }
Example #4
0
 /**
  * This method returns the latter value should the former value evaluates
  * to null.
  *
  * @access public
  * @static
  * @param IObject\Type $x                                   the value to be evaluated
  * @param IObject\Type $y                                   the default value
  * @return IObject\Type                                     the result
  */
 public static function nvl(IObject\Type $x = null, IObject\Type $y = null) : IObject\Type
 {
     return $x ?? $y ?? IObject\Type::box(null);
 }
Example #5
0
 /**
  * This method tests the "hashCode" method.
  *
  * @dataProvider data_hashCode
  */
 public function test_hashCode(array $provided)
 {
     $p0 = IObject\Type::box($provided[0])->hashCode();
     $this->assertInstanceOf('\\Saber\\Data\\IString\\Type', $p0);
     $this->assertRegExp('/^[0-9a-f]{32}$/', $p0->unbox());
 }