phpOMS/tests/Math/Geometry/Shape/D2/CircleTest.php
2024-03-20 07:21:26 +00:00

54 lines
1.7 KiB
PHP
Executable File

<?php
/**
* Jingga
*
* PHP Version 8.2
*
* @package tests
* @copyright Dennis Eichhorn
* @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1);
namespace phpOMS\tests\Math\Geometry\Shape\D2;
use phpOMS\Math\Geometry\Shape\D2\Circle;
/**
* @internal
*/
#[\PHPUnit\Framework\Attributes\CoversClass(\phpOMS\Math\Geometry\Shape\D2\Circle::class)]
#[\PHPUnit\Framework\Attributes\TestDox('phpOMS\tests\Math\Geometry\Shape\D2\CircleTest: Circle shape')]
final class CircleTest extends \PHPUnit\Framework\TestCase
{
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('The surface can be calculated')]
public function testSurface() : void
{
self::assertEqualsWithDelta(12.57, Circle::getSurface(2), 0.01);
}
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('The perimeter can be calculated')]
public function testPerimeter() : void
{
self::assertEqualsWithDelta(12.57, Circle::getPerimeter(2), 0.01);
}
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('The radius can be calculated with the surface')]
public function testRadiusBySurface() : void
{
self::assertEqualsWithDelta(2.0, Circle::getRadiusBySurface(Circle::getSurface(2)), 0.001);
}
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('The radius can be calculated with the perimeter')]
public function testRadiusByPerimeter() : void
{
self::assertEqualsWithDelta(2.0, Circle::getRadiusByPerimeter(Circle::getPerimeter(2)), 0.001);
}
}