php-kilo/tests/ANSITest.php
Timothy Warren 998102816e
Some checks failed
timw4mail/php-kilo/pipeline/head There was a failure building this commit
Use c stdlib function to set up raw mode
2023-10-10 13:02:05 -04:00

34 lines
716 B
PHP

<?php declare(strict_types=1);
namespace Aviat\Kilo\Tests;
use Aviat\Kilo\Enum\Color;
use Aviat\Kilo\Terminal\ANSI;
use PHPUnit\Framework\TestCase;
class ANSITest extends TestCase {
public function testColor():void
{
$this->assertEquals("\e[44m", ANSI::color(Color::BG_BLUE));
}
public function testRgbColor(): void
{
$this->assertEquals("\e[38;2;128;128;128m", ANSI::rgbColor(128, 128, 128));
}
public function testMoveCursor(): void
{
$this->assertEquals("\e[25;40H", ANSI::moveCursor(24, 39));
}
public function testScrollUp(): void
{
$this->assertEquals("\e[5S", ANSI::scrollUp(5));
}
public function testScrollDown(): void
{
$this->assertEquals("\e[5T", ANSI::scrollDown(5));
}
}