示例#1
0
 /**
  * This method tests the "multiply" method.
  *
  * @dataProvider data_multiply
  */
 public function test_multiply(array $provided, array $expected)
 {
     $p0 = IDouble\Module::multiply(IDouble\Type::box($provided[0]), IDouble\Type::box($provided[1]));
     $e0 = $expected[0];
     $this->assertInstanceOf('\\Saber\\Data\\IDouble\\Type', $p0);
     $this->assertSame($e0, $p0->unbox());
 }
示例#2
0
 /**
  * This method returns the product of all items in the list.
  *
  * @access public
  * @static
  * @param ISeq\Type $xs                                     the sequence to be processed
  * @return IDouble\Type                                     the result
  */
 public static function product(ISeq\Type $xs) : IDouble\Type
 {
     return $xs->foldLeft(function (IDouble\Type $c, INumber\Type $x) {
         return IDouble\Module::multiply($c, $x->toDouble());
     }, IDouble\Type::one());
 }