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 compares the operands for order.
  *
  * @access public
  * @static
  * @param IObject\Type $x                                   the left operand
  * @param IObject\Type $y                                   the right operand
  * @return ITrit\Type                                       the order as to whether the left
  *                                                          operand is less than, equals to,
  *                                                          or greater than the right operand
  */
 public static function compare(IObject\Type $x, IObject\Type $y) : ITrit\Type
 {
     $__x = $x->unbox();
     $__y = $y->unbox();
     if ($__x < $__y) {
         return ITrit\Type::negative();
     } else {
         if ($__x == $__y) {
             return ITrit\Type::zero();
         } else {
             return ITrit\Type::positive();
         }
     }
 }
Example #5
0
 /**
  * This method tests the "toString" method.
  *
  * @dataProvider data_toString
  */
 public function test_toString(array $provided, array $expected)
 {
     $p0 = IObject\Type::make($provided[0])->toString();
     $e0 = $expected[0];
     $this->assertInstanceOf('\\Saber\\Data\\IString\\Type', $p0);
     $this->assertSame($e0, $p0->unbox());
 }