php-kilo/tests/Enum/KeyTypeTest.php

36 lines
703 B
PHP
Raw Normal View History

2020-02-05 15:20:32 -05:00
<?php declare(strict_types=1);
namespace Aviat\Kilo\Tests\Enum;
use Aviat\Kilo\Enum\KeyType;
use PHPUnit\Framework\TestCase;
class KeyTypeTest extends TestCase {
public function testSanityCheck(): void
{
for ($i = 1; $i < 27; $i++)
{
$char = chr(0x60 + $i);
$ord = $i;
$expected = chr($ord);
$actual = KeyType::CTRL($char);
$this->assertEquals($expected, $actual, "CTRL + '{$char}' should return chr($ord)");
}
}
public function testNullOnInvalidChar(): void
{
$this->assertNull(KeyType::CTRL("\t"));
}
public function testSameOutputOnUpperOrLower(): void
{
$lower = KeyType::CTRL('v');
$upper = KeyType::CTRL('V');
$this->assertEquals($lower, $upper);
}
}