diff --git a/tests/Math/Functions/FunctionsTest.php b/tests/Math/Functions/FunctionsTest.php index f88839b89..517231cb1 100644 --- a/tests/Math/Functions/FunctionsTest.php +++ b/tests/Math/Functions/FunctionsTest.php @@ -68,4 +68,29 @@ class FunctionsTest extends \PHPUnit\Framework\TestCase self::assertEquals(5, Functions::getRelativeDegree(12, 12, 7)); self::assertEquals(11, Functions::getRelativeDegree(6, 12, 7)); } + + public function testPower() + { + self::assertEquals( + [4, 9, 16], + Functions::powerInt([2, 3, 4], 2) + ); + + self::assertEquals( + [8, 27, 64], + Functions::powerInt([2, 3, 4], 3) + ); + + self::assertEquals( + [2, 3, 8], + Functions::powerInt([4, 9, 16], 1/2), + '', 0.0 + ); + + self::assertEquals( + [2, 3, 8], + Functions::powerInt([8, 27, 64], 1/3), + '', 0.0 + ); + } }