mirror of
https://github.com/danog/endtoend-test-psl.git
synced 2025-01-22 05:11:47 +01:00
[Iter] test merge and zip
This commit is contained in:
parent
623d014812
commit
439a28972b
23
tests/Psl/Iter/MergeTest.php
Normal file
23
tests/Psl/Iter/MergeTest.php
Normal file
@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Psl\Tests\Iter;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Psl\Iter;
|
||||
|
||||
class MergeTest extends TestCase
|
||||
{
|
||||
public function testMap(): void
|
||||
{
|
||||
$result = Iter\merge([1, 2], [9, 8]);
|
||||
|
||||
$entries = Iter\to_array(Iter\enumerate($result));
|
||||
|
||||
static::assertSame($entries[0], [0, 1]);
|
||||
static::assertSame($entries[1], [1, 2]);
|
||||
static::assertSame($entries[2], [0, 9]);
|
||||
static::assertSame($entries[3], [1, 8]);
|
||||
}
|
||||
}
|
@ -38,4 +38,11 @@ class ZipTest extends TestCase
|
||||
static::assertSame([2, 2, 2], $k);
|
||||
static::assertSame([3, 7, 12], $v);
|
||||
}
|
||||
|
||||
public function testZipWithZeroIterables(): void
|
||||
{
|
||||
$result = Iter\zip(...[]);
|
||||
|
||||
self::assertCount(0, $result);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user