endtoend-test-psl/tests/Psl/Str/FromCodePointsTest.php

27 lines
698 B
PHP
Raw Normal View History

2019-12-24 01:52:07 +01:00
<?php
declare(strict_types=1);
namespace Psl\Tests\Str;
use PHPUnit\Framework\TestCase;
2019-12-26 23:10:57 +01:00
use Psl\Str;
2019-12-24 01:52:07 +01:00
class FromCodePointsTest extends TestCase
{
2019-12-26 23:10:57 +01:00
public function testFromCodePoints(): void
{
self::assertSame(/* NULL = */ Str\chr(0), Str\from_code_points(0));
self::assertSame('مرحبا بكم', Str\from_code_points(1605, 1585, 1581, 1576, 1575, 32, 1576, 1603, 1605));
self::assertSame('Hello', Str\from_code_points(72, 101, 108, 108, 111));
self::assertSame('ẞoo!', Str\from_code_points(7838, 111, 111, 33));
self::assertSame('ς', Str\from_code_points(962));
2019-12-26 23:10:57 +01:00
self::assertSame("\u{10001}", Str\from_code_points(65537));
2019-12-26 23:10:57 +01:00
}
2019-12-24 01:52:07 +01:00
}