From 66cdad79db0bae41f292c72b4db79fcc1f6ae2a2 Mon Sep 17 00:00:00 2001 From: Tomas Norre Mikkelsen Date: Wed, 30 Oct 2024 08:32:23 +0100 Subject: [PATCH] sync diamond --- .../practice/diamond/.docs/instructions.md | 27 ++++++------ exercises/practice/diamond/.meta/config.json | 2 +- exercises/practice/diamond/.meta/example.php | 22 ---------- exercises/practice/diamond/DiamondTest.php | 42 +++++++++---------- 4 files changed, 34 insertions(+), 59 deletions(-) diff --git a/exercises/practice/diamond/.docs/instructions.md b/exercises/practice/diamond/.docs/instructions.md index 1de7016f..3034802f 100644 --- a/exercises/practice/diamond/.docs/instructions.md +++ b/exercises/practice/diamond/.docs/instructions.md @@ -1,22 +1,21 @@ # Instructions -The diamond kata takes as its input a letter, and outputs it in a diamond -shape. Given a letter, it prints a diamond starting with 'A', with the -supplied letter at the widest point. +The diamond kata takes as its input a letter, and outputs it in a diamond shape. +Given a letter, it prints a diamond starting with 'A', with the supplied letter at the widest point. ## Requirements -* The first row contains one 'A'. -* The last row contains one 'A'. -* All rows, except the first and last, have exactly two identical letters. -* All rows have as many trailing spaces as leading spaces. (This might be 0). -* The diamond is horizontally symmetric. -* The diamond is vertically symmetric. -* The diamond has a square shape (width equals height). -* The letters form a diamond shape. -* The top half has the letters in ascending order. -* The bottom half has the letters in descending order. -* The four corners (containing the spaces) are triangles. +- The first row contains one 'A'. +- The last row contains one 'A'. +- All rows, except the first and last, have exactly two identical letters. +- All rows have as many trailing spaces as leading spaces. (This might be 0). +- The diamond is horizontally symmetric. +- The diamond is vertically symmetric. +- The diamond has a square shape (width equals height). +- The letters form a diamond shape. +- The top half has the letters in ascending order. +- The bottom half has the letters in descending order. +- The four corners (containing the spaces) are triangles. ## Examples diff --git a/exercises/practice/diamond/.meta/config.json b/exercises/practice/diamond/.meta/config.json index 3105cac2..d7221f0b 100644 --- a/exercises/practice/diamond/.meta/config.json +++ b/exercises/practice/diamond/.meta/config.json @@ -19,5 +19,5 @@ }, "blurb": "Given a letter, print a diamond starting with 'A' with the supplied letter at the widest point.", "source": "Seb Rose", - "source_url": "https://claysnow.co.uk/recycling-tests-in-tdd/" + "source_url": "https://web.archive.org/web/20220807163751/http://claysnow.co.uk/recycling-tests-in-tdd/" } diff --git a/exercises/practice/diamond/.meta/example.php b/exercises/practice/diamond/.meta/example.php index 8f4b7a8c..87348afe 100644 --- a/exercises/practice/diamond/.meta/example.php +++ b/exercises/practice/diamond/.meta/example.php @@ -1,27 +1,5 @@ . - * - * To disable strict typing, comment out the directive below. - */ - declare(strict_types=1); function diamond($limit) diff --git a/exercises/practice/diamond/DiamondTest.php b/exercises/practice/diamond/DiamondTest.php index 40c35b9a..e7e82de4 100644 --- a/exercises/practice/diamond/DiamondTest.php +++ b/exercises/practice/diamond/DiamondTest.php @@ -1,27 +1,5 @@ . - * - * To disable strict typing, comment out the directive below. - */ - declare(strict_types=1); class DiamondTest extends PHPUnit\Framework\TestCase @@ -31,11 +9,19 @@ public static function setUpBeforeClass(): void require_once 'Diamond.php'; } + /** + * uuid: 202fb4cc-6a38-4883-9193-a29d5cb92076 + * @testdox Degenerate case with a single 'A' row + */ public function testDegenerateCaseWithASingleARow(): void { $this->assertEquals(["A"], diamond("A")); } + /** + * uuid: bd6a6d78-9302-42e9-8f60-ac1461e9abae + * @testdox Degenerate case with no row containing 3 distinct groups of spaces + */ public function testDegenerateCaseWithNoRowContaining3DistinctGroupsOfSpaces(): void { $this->assertEquals( @@ -48,6 +34,10 @@ public function testDegenerateCaseWithNoRowContaining3DistinctGroupsOfSpaces(): ); } + /** + * uuid: af8efb49-14ed-447f-8944-4cc59ce3fd76 + * @testdox Smallest non-degenerate case with odd diamond side length + */ public function testSmallestNonDegenerateCaseWithOddDiamondSideLength(): void { $this->assertEquals( @@ -62,6 +52,10 @@ public function testSmallestNonDegenerateCaseWithOddDiamondSideLength(): void ); } + /** + * uuid: e0c19a95-9888-4d05-86a0-fa81b9e70d1d + * @testdox Smallest non-degenerate case with even diamond side length + */ public function testSmallestNonDegenerateCaseWithEvenDiamondSideLength(): void { $this->assertEquals( @@ -78,6 +72,10 @@ public function testSmallestNonDegenerateCaseWithEvenDiamondSideLength(): void ); } + /** + * uuid: 82ea9aa9-4c0e-442a-b07e-40204e925944 + * @testdox Largest possible diamond + */ public function testLargestPossibleDiamond(): void { $this->assertEquals(