trueskill/tests/GuardTest.php

34 lines
911 B
PHP
Raw Normal View History

2024-02-02 14:53:38 +00:00
<?php
declare(strict_types=1);
2024-01-12 14:54:04 +00:00
namespace DNW\Skills\Tests;
use DNW\Skills\Guard;
use Exception;
use PHPUnit\Framework\TestCase;
2024-01-16 07:46:32 +00:00
2024-01-12 14:54:04 +00:00
class GuardTest extends TestCase
{
public function testargumentIsValidIndex(): void
{
$this->expectException(Exception::class);
$this->expectExceptionMessage('dummy is an invalid index');
Guard::argumentIsValidIndex(10, 10, "dummy");
2024-01-12 14:54:04 +00:00
}
public function testargumentIsValidIndex2(): void
{
$this->expectException(Exception::class);
$this->expectExceptionMessage('dummy is an invalid index');
Guard::argumentIsValidIndex(-1, 10, "dummy");
}
2024-01-12 14:54:04 +00:00
public function testargumentInRangeInclusive(): void
{
$this->expectException(Exception::class);
$this->expectExceptionMessage('dummy is not in the valid range [0, 100]');
2024-01-12 14:54:04 +00:00
Guard::argumentInRangeInclusive(101, 0, 100, "dummy");
}
}