mirror of
https://github.com/Llewellynvdm/php-ml.git
synced 2024-11-25 14:27:34 +00:00
946fbbc521
* tests: update to PHPUnit 6.0 with rector * [cs] clean empty docs * composer: bump to PHPUnit 6.4 * tests: use class references over strings * cleanup
30 lines
725 B
PHP
30 lines
725 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace tests\Phpml\Dataset;
|
|
|
|
use Phpml\Dataset\ArrayDataset;
|
|
use Phpml\Exception\InvalidArgumentException;
|
|
use PHPUnit\Framework\TestCase;
|
|
|
|
class ArrayDatasetTest extends TestCase
|
|
{
|
|
public function testThrowExceptionOnInvalidArgumentsSize(): void
|
|
{
|
|
$this->expectException(InvalidArgumentException::class);
|
|
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());
|
|
}
|
|
}
|