diff --git a/tests/GuardTest.php b/tests/GuardTest.php index 42c97ec..3de9b7d 100644 --- a/tests/GuardTest.php +++ b/tests/GuardTest.php @@ -12,24 +12,43 @@ use PHPUnit\Framework\Attributes\CoversClass; #[CoversClass(Guard::class)] class GuardTest extends TestCase { - public function testargumentIsValidIndex(): void + public function testargumentIsValidIndexArgumentAbove(): void { $this->expectException(Exception::class); $this->expectExceptionMessage('dummy is an invalid index'); Guard::argumentIsValidIndex(10, 10, "dummy"); } - public function testargumentIsValidIndex2(): void + public function testargumentIsValidIndexArgumentBelow(): void { $this->expectException(Exception::class); $this->expectExceptionMessage('dummy is an invalid index'); Guard::argumentIsValidIndex(-1, 10, "dummy"); } - public function testargumentInRangeInclusive(): void + public function testargumentIsValidIndexArgumentValid(): void + { + Guard::argumentIsValidIndex(5, 10, "dummy"); + $this->expectNotToPerformAssertions(); + } + + public function testargumentInRangeInclusiveAbove(): void { $this->expectException(Exception::class); $this->expectExceptionMessage('dummy is not in the valid range [0, 100]'); Guard::argumentInRangeInclusive(101, 0, 100, "dummy"); } + + public function testargumentInRangeInclusiveBelow(): void + { + $this->expectException(Exception::class); + $this->expectExceptionMessage('dummy is not in the valid range [0, 100]'); + Guard::argumentInRangeInclusive(-1, 0, 100, "dummy"); + } + + public function testargumentInRangeInclusiveValid(): void + { + Guard::argumentInRangeInclusive(50, 0, 100, "dummy"); + $this->expectNotToPerformAssertions(); + } } diff --git a/tests/PartialPlayTest.php b/tests/PartialPlayTest.php new file mode 100644 index 0000000..c5925cc --- /dev/null +++ b/tests/PartialPlayTest.php @@ -0,0 +1,27 @@ +assertEquals($p->getPartialPlayPercentage(), PartialPlay::getPartialPlayPercentage($p)); + + $p = new Player(1, 0.000000); + $this->assertNotEquals(0.0, PartialPlay::getPartialPlayPercentage($p)); + } +}