php-ml/tests/Phpml/Math/ProductTest.php
Tomáš Votruba 653c7c772d Upgrade to PHP 7.1 (#150)
* upgrade to PHP 7.1

* bump travis and composer to PHP 7.1

* fix tests
2017-11-14 21:21:23 +01:00

22 lines
551 B
PHP

<?php
declare(strict_types=1);
namespace tests\Phpml\Math;
use Phpml\Math\Product;
use PHPUnit\Framework\TestCase;
class ProductTest extends TestCase
{
public function testScalarProduct(): void
{
$this->assertEquals(10, Product::scalar([2, 3], [-1, 4]));
$this->assertEquals(-0.1, Product::scalar([1, 4, 1], [-2, 0.5, -0.1]));
$this->assertEquals(8, Product::scalar([2], [4]));
//test for non numeric values
$this->assertEquals(0, Product::scalar(['', null, [], new \stdClass()], [null]));
}
}