-
-
Notifications
You must be signed in to change notification settings - Fork 189
/
Copy pathBooleanConverterTest.php
57 lines (48 loc) · 1.18 KB
/
BooleanConverterTest.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
<?php
namespace Rubix\ML\Tests\Transformers;
use Rubix\ML\Datasets\Unlabeled;
use Rubix\ML\Transformers\BooleanConverter;
use Rubix\ML\Transformers\Transformer;
use PHPUnit\Framework\TestCase;
/**
* @group Transformers
* @covers \Rubix\ML\Transformers\BooleanConverterTest
*/
class BooleanConverterTest extends TestCase
{
/**
* @var BooleanConverter
*/
protected $transformer;
/**
* @before
*/
protected function setUp() : void
{
$this->transformer = new BooleanConverter('!true!', '!false!');
}
/**
* @test
*/
public function build() : void
{
$this->assertInstanceOf(BooleanConverter::class, $this->transformer);
$this->assertInstanceOf(Transformer::class, $this->transformer);
}
/**
* @test
*/
public function transform() : void
{
$dataset = new Unlabeled([
[true, 'true', '1', 1],
[false, 'false', '0', 0],
]);
$dataset->apply($this->transformer);
$expected = [
['!true!', 'true', '1', 1],
['!false!', 'false', '0', 0],
];
$this->assertEquals($expected, $dataset->samples());
}
}