value); self::assertSame(0.5, (new Coefficient(0.5))->value); self::assertSame(1.0, (new Coefficient(1.0))->value); self::assertSame(1.5, (new Coefficient(1.5))->value); self::assertSame(2.0, (new Coefficient(2.0))->value); self::assertSame(10.0, (new Coefficient(10.0))->value); } #[Test] public function rejectsTooSmall(): void { $this->expectException(CoefficientInvalideException::class); new Coefficient(0.0); } #[Test] public function rejectsTooLarge(): void { $this->expectException(CoefficientInvalideException::class); new Coefficient(10.1); } #[Test] public function rejectsNegative(): void { $this->expectException(CoefficientInvalideException::class); new Coefficient(-1.0); } #[Test] public function equalsComparesValue(): void { $a = new Coefficient(1.5); $b = new Coefficient(1.5); $c = new Coefficient(2.0); self::assertTrue($a->equals($b)); self::assertFalse($a->equals($c)); } }