php-ml/tests/Phpml/Dataset/ArrayDatasetTest.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

31 lines
698 B
PHP

<?php
declare(strict_types=1);
namespace tests\Phpml\Dataset;
use Phpml\Dataset\ArrayDataset;
use PHPUnit\Framework\TestCase;
class ArrayDatasetTest extends TestCase
{
/**
* @expectedException \Phpml\Exception\InvalidArgumentException
*/
public function testThrowExceptionOnInvalidArgumentsSize(): void
{
new ArrayDataset([0, 1], [0]);
}
public function testArrayDataset(): void
{
$dataset = new ArrayDataset(
$samples = [[1], [2], [3], [4]],
$labels = ['a', 'a', 'b', 'b']
);
$this->assertEquals($samples, $dataset->getSamples());
$this->assertEquals($labels, $dataset->getTargets());
}
}