mirror of
https://github.com/danog/endtoend-test-psl.git
synced 2024-12-11 16:49:40 +01:00
32 lines
750 B
PHP
32 lines
750 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Psl\Tests\Vec;
|
|
|
|
use PHPUnit\Framework\TestCase;
|
|
use Psl\Vec;
|
|
|
|
final class EnumerateTest extends TestCase
|
|
{
|
|
/**
|
|
* @dataProvider provideData
|
|
*/
|
|
public function testEnumerate(array $expected, iterable $iterable): void
|
|
{
|
|
static::assertSame($expected, Vec\enumerate($iterable));
|
|
}
|
|
|
|
public function provideData(): iterable
|
|
{
|
|
yield [[], []];
|
|
yield [[['a', 'b'], ['c', 'd']], ['a' => 'b', 'c' => 'd']];
|
|
yield [[['a', 'b'], ['a', 'b'], ['a', 'b']], (static function () {
|
|
yield 'a' => 'b';
|
|
yield 'a' => 'b';
|
|
yield 'a' => 'b';
|
|
})()];
|
|
yield [[['a', null], ['b', 0]], ['a' => null, 'b' => 0]];
|
|
}
|
|
}
|