2019-12-24 01:52:07 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
|
|
namespace Psl\Tests\Iter;
|
|
|
|
|
|
|
|
use PHPUnit\Framework\TestCase;
|
2020-07-16 17:11:54 +02:00
|
|
|
use Psl\Collection;
|
|
|
|
use Psl\Iter;
|
2019-12-24 01:52:07 +01:00
|
|
|
|
|
|
|
class ChainTest extends TestCase
|
|
|
|
{
|
2020-07-16 17:11:54 +02:00
|
|
|
public function testChain(): void
|
|
|
|
{
|
|
|
|
static::assertCount(0, Iter\chain());
|
|
|
|
static::assertCount(0, Iter\chain([], new Iter\Iterator([])));
|
|
|
|
static::assertCount(0, Iter\chain([], new Iter\Iterator([])));
|
|
|
|
|
|
|
|
/** @var Iter\Iterator<int, int> $chain */
|
|
|
|
$chain = Iter\chain(
|
|
|
|
[1],
|
|
|
|
Iter\range(2, 5),
|
|
|
|
new Collection\Vector([6])
|
|
|
|
);
|
|
|
|
|
|
|
|
static::assertSame([1, 2, 3, 4, 5, 6], Iter\to_array($chain));
|
|
|
|
}
|
2019-12-24 01:52:07 +01:00
|
|
|
}
|