endtoend-test-psl/tests/Psl/Vec/ReverseTest.php
2021-02-13 20:16:20 +01:00

27 lines
521 B
PHP

<?php
declare(strict_types=1);
namespace Psl\Tests\Vec;
use PHPUnit\Framework\TestCase;
use Psl\Iter;
use Psl\Vec;
final class ReverseTest extends TestCase
{
public function testReverse(): void
{
$result = Vec\reverse(['foo', 'bar', 'baz', 'qux']);
static::assertSame(['qux', 'baz', 'bar', 'foo'], $result);
}
public function testReverseEarlyReturnForEmptyIterables(): void
{
$result = Vec\reverse(Iter\to_iterator([]));
static::assertSame([], $result);
}
}