-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathArrayCartesianProductTest.php
More file actions
45 lines (40 loc) · 1.14 KB
/
ArrayCartesianProductTest.php
File metadata and controls
45 lines (40 loc) · 1.14 KB
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
<?php
declare(strict_types=1);
namespace Recruiter\Array\Tests;
use PHPUnit\Framework\TestCase;
use function Recruiter\Array\array_cartesian_product;
class ArrayCartesianProductTest extends TestCase
{
public function testArrayCartesianProduct(): void
{
$this->assertSame(
[[]],
array_cartesian_product([]),
);
$this->assertSame(
[[1, 2]],
array_cartesian_product([[1], [2]]),
);
$this->assertSame(
[[1]],
array_cartesian_product([[1]]),
);
$this->assertSame(
[[1, 2]],
array_cartesian_product([[1], [2]]),
);
$this->assertSame(
[[1, 2], [1, 3]],
array_cartesian_product([[1], [2, 3]]),
);
$this->assertSame(
[[1, 3], [1, 4], [2, 3], [2, 4]],
array_cartesian_product([[1, 2], [3, 4]]),
);
$this->assertSame(
[[1, 3, 5], [1, 3, 6], [1, 3, 7], [1, 3, 8],
[1, 4, 5], [1, 4, 6], [1, 4, 7], [1, 4, 8]],
array_cartesian_product([[1], [3, 4], [5, 6, 7, 8]]),
);
}
}