Ejemplo n.º 1
0
 /**
  * This method tests the "ge" method.
  *
  * @dataProvider data_ge
  */
 public function test_ge(array $provided, array $expected)
 {
     $p0 = IDouble\Module::ge(IDouble\Type::box($provided[0]), IDouble\Type::box($provided[1]));
     $e0 = $expected[0];
     $this->assertInstanceOf('\\Saber\\Data\\IBool\\Type', $p0);
     $this->assertSame($e0, $p0->unbox());
 }
Ejemplo n.º 2
0
 /**
  * This method returns a list of all numbers for the specified sequence.
  *
  * @access public
  * @static
  * @param IDouble\Type $x                                   where to start
  * @param Core\Type $y                                      either an integer representing
  *                                                          the end of the sequence or a
  *                                                          tuple describing the sequence
  * @return IArrayList\Type                                  an empty array list
  */
 public static function sequence(IDouble\Type $x, Core\Type $y) : IArrayList\Type
 {
     $buffer = array();
     if ($y instanceof ITuple\Type) {
         $s = IDouble\Module::subtract($y->first(), $x);
         $n = $y->second();
     } else {
         // ($y instanceof IDouble\Type)
         $s = IDouble\Type::one();
         $n = $y;
     }
     if (IDouble\Module::isNegative($s)->unbox()) {
         for ($i = $x; IDouble\Module::ge($i, $n)->unbox(); $i = IDouble\Module::add($i, $s)) {
             $buffer[] = $i;
         }
     } else {
         for ($i = $x; IDouble\Module::le($i, $n)->unbox(); $i = IDouble\Module::add($i, $s)) {
             $buffer[] = $i;
         }
     }
     return IArrayList\Type::box($buffer);
 }