diff --git a/exercises/practice/difference-of-squares/.docs/instructions.md b/exercises/practice/difference-of-squares/.docs/instructions.md index c3999e86..39c38b50 100644 --- a/exercises/practice/difference-of-squares/.docs/instructions.md +++ b/exercises/practice/difference-of-squares/.docs/instructions.md @@ -8,10 +8,7 @@ The square of the sum of the first ten natural numbers is The sum of the squares of the first ten natural numbers is 1² + 2² + ... + 10² = 385. -Hence the difference between the square of the sum of the first -ten natural numbers and the sum of the squares of the first ten -natural numbers is 3025 - 385 = 2640. +Hence the difference between the square of the sum of the first ten natural numbers and the sum of the squares of the first ten natural numbers is 3025 - 385 = 2640. -You are not expected to discover an efficient solution to this yourself from -first principles; research is allowed, indeed, encouraged. Finding the best -algorithm for the problem is a key skill in software engineering. +You are not expected to discover an efficient solution to this yourself from first principles; research is allowed, indeed, encouraged. +Finding the best algorithm for the problem is a key skill in software engineering. diff --git a/exercises/practice/difference-of-squares/.meta/config.json b/exercises/practice/difference-of-squares/.meta/config.json index 9b6a4449..b8ab7b26 100644 --- a/exercises/practice/difference-of-squares/.meta/config.json +++ b/exercises/practice/difference-of-squares/.meta/config.json @@ -7,7 +7,8 @@ "kytrinyx", "lafent", "petemcfarlane", - "Scientifica96" + "Scientifica96", + "mk-mxp" ], "files": { "solution": [ diff --git a/exercises/practice/difference-of-squares/.meta/example.php b/exercises/practice/difference-of-squares/.meta/example.php index f336ed5a..b05919fe 100644 --- a/exercises/practice/difference-of-squares/.meta/example.php +++ b/exercises/practice/difference-of-squares/.meta/example.php @@ -1,27 +1,5 @@ . - * - * To disable strict typing, comment out the directive below. - */ - declare(strict_types=1); function squareOfSum($max) diff --git a/exercises/practice/difference-of-squares/DifferenceOfSquaresTest.php b/exercises/practice/difference-of-squares/DifferenceOfSquaresTest.php index 06b80b83..242de942 100644 --- a/exercises/practice/difference-of-squares/DifferenceOfSquaresTest.php +++ b/exercises/practice/difference-of-squares/DifferenceOfSquaresTest.php @@ -1,27 +1,5 @@ . - * - * To disable strict typing, comment out the directive below. - */ - declare(strict_types=1); class DifferenceOfSquaresTest extends PHPUnit\Framework\TestCase @@ -31,46 +9,82 @@ public static function setUpBeforeClass(): void require_once 'DifferenceOfSquares.php'; } - public function testSquareOfSumTo5(): void + /** + * uuid e46c542b-31fc-4506-bcae-6b62b3268537 + * @testdox Square of sum 1 + */ + public function testSquareOfSumTo1(): void { - $this->assertEquals(225, squareOfSum(5)); + $this->assertEquals(1, squareOfSum(1)); } - public function testSumOfSquaresTo5(): void + /** + * uuid 9b3f96cb-638d-41ee-99b7-b4f9c0622948 + * @testdox Square of sum 5 + */ + public function testSquareOfSumTo5(): void { - $this->assertEquals(55, sumOfSquares(5)); + $this->assertEquals(225, squareOfSum(5)); } - public function testDifferenceOfSumTo5(): void + /** + * uuid 54ba043f-3c35-4d43-86ff-3a41625d5e86 + * @testdox Square of sum 100 + */ + public function testSquareOfSumTo100(): void { - $this->assertEquals(170, difference(5)); + $this->assertEquals(25502500, squareOfSum(100)); } - public function testSquareOfSumTo10(): void + /** + * uuid 01d84507-b03e-4238-9395-dd61d03074b5 + * @testdox Sum of squares 1 + */ + public function testSumOfSquaresTo1(): void { - $this->assertEquals(3025, squareOfSum(10)); + $this->assertEquals(1, sumOfSquares(1)); } - public function testSumOfSquaresTo10(): void + /** + * uuid c93900cd-8cc2-4ca4-917b-dd3027023499 + * @testdox Sum of squares 5 + */ + public function testSumOfSquaresTo5(): void { - $this->assertEquals(385, sumOfSquares(10)); + $this->assertEquals(55, sumOfSquares(5)); } - public function testDifferenceOfSumTo10(): void + /** + * uuid 94807386-73e4-4d9e-8dec-69eb135b19e4 + * @testdox Sum of squares 100 + */ + public function testSumOfSquaresTo100(): void { - $this->assertEquals(2640, difference(10)); + $this->assertEquals(338350, sumOfSquares(100)); } - public function testSquareOfSumTo100(): void + /** + * uuid 44f72ae6-31a7-437f-858d-2c0837adabb6 + * @testdox Difference of squares 1 + */ + public function testDifferenceOfSumTo1(): void { - $this->assertEquals(25502500, squareOfSum(100)); + $this->assertEquals(0, difference(1)); } - public function testSumOfSquaresTo100(): void + /** + * uuid 005cb2bf-a0c8-46f3-ae25-924029f8b00b + * @testdox Difference of squares 5 + */ + public function testDifferenceOfSumTo5(): void { - $this->assertEquals(338350, sumOfSquares(100)); + $this->assertEquals(170, difference(5)); } + /** + * uuid b1bf19de-9a16-41c0-a62b-1f02ecc0b036 + * @testdox Difference of squares 100 + */ public function testDifferenceOfSumTo100(): void { $this->assertEquals(25164150, difference(100));