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

27 lines
716 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
final class FromCodePointsTest extends TestCase
2019-12-24 01:52:07 +01:00
{
2019-12-26 23:10:57 +01:00
public function testFromCodePoints(): void
{
static::assertSame(/* NULL = */ Str\chr(0), Str\from_code_points(0));
2019-12-26 23:10:57 +01:00
static::assertSame('مرحبا بكم', Str\from_code_points(1605, 1585, 1581, 1576, 1575, 32, 1576, 1603, 1605));
2019-12-26 23:10:57 +01:00
static::assertSame('Hello', Str\from_code_points(72, 101, 108, 108, 111));
2019-12-26 23:10:57 +01:00
static::assertSame('ẞoo!', Str\from_code_points(7838, 111, 111, 33));
2019-12-26 23:10:57 +01:00
static::assertSame('ς', Str\from_code_points(962));
2019-12-26 23:10:57 +01:00
static::assertSame("\u{10001}", Str\from_code_points(65537));
2019-12-26 23:10:57 +01:00
}
2019-12-24 01:52:07 +01:00
}