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());
|
2020-09-01 03:03:19 +02:00
|
|
|
static::assertCount(0, Iter\chain([], Iter\Iterator::create([])));
|
|
|
|
static::assertCount(0, Iter\chain([], Iter\Iterator::create([])));
|
2020-07-16 17:11:54 +02:00
|
|
|
|
|
|
|
/** @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
|
|
|
}
|