diff --git a/exercises/practice/acronym/.docs/instructions.md b/exercises/practice/acronym/.docs/instructions.md index e0515b4d1..133bd2cbb 100644 --- a/exercises/practice/acronym/.docs/instructions.md +++ b/exercises/practice/acronym/.docs/instructions.md @@ -4,5 +4,14 @@ Convert a phrase to its acronym. Techies love their TLA (Three Letter Acronyms)! -Help generate some jargon by writing a program that converts a long name -like Portable Network Graphics to its acronym (PNG). +Help generate some jargon by writing a program that converts a long name like Portable Network Graphics to its acronym (PNG). + +Punctuation is handled as follows: hyphens are word separators (like whitespace); all other punctuation can be removed from the input. + +For example: + +| Input | Output | +| ------------------------- | ------ | +| As Soon As Possible | ASAP | +| Liquid-crystal display | LCD | +| Thank George It's Friday! | TGIF | diff --git a/exercises/practice/acronym/.meta/config.json b/exercises/practice/acronym/.meta/config.json index f64a42f2f..55256db22 100644 --- a/exercises/practice/acronym/.meta/config.json +++ b/exercises/practice/acronym/.meta/config.json @@ -20,7 +20,7 @@ ".meta/example.php" ] }, - "blurb": "Convert a long phrase to its acronym", + "blurb": "Convert a long phrase to its acronym.", "source": "Julien Vanier", "source_url": "https://github.com/monkbroc" } diff --git a/exercises/practice/acronym/.meta/example.php b/exercises/practice/acronym/.meta/example.php index f0da6efe9..f7b4970e4 100644 --- a/exercises/practice/acronym/.meta/example.php +++ b/exercises/practice/acronym/.meta/example.php @@ -1,27 +1,5 @@ . - * - * To disable strict typing, comment out the directive below. - */ - declare(strict_types=1); /** diff --git a/exercises/practice/acronym/.meta/tests.toml b/exercises/practice/acronym/.meta/tests.toml index 157cae14e..522e7b488 100644 --- a/exercises/practice/acronym/.meta/tests.toml +++ b/exercises/practice/acronym/.meta/tests.toml @@ -25,6 +25,11 @@ description = "consecutive delimiters" [5118b4b1-4572-434c-8d57-5b762e57973e] description = "apostrophes" +included = false +comment = "This invalidates existing solutions that rely on RegExp word boundary detection" [adc12eab-ec2d-414f-b48c-66a4fc06cdef] description = "underscore emphasis" +included = false +comment = "This also invalidates existing solutions that rely on RegExp word boundary detection" + diff --git a/exercises/practice/acronym/AcronymTest.php b/exercises/practice/acronym/AcronymTest.php index 99d1e3fb5..c010f8c62 100644 --- a/exercises/practice/acronym/AcronymTest.php +++ b/exercises/practice/acronym/AcronymTest.php @@ -1,27 +1,5 @@ . - * - * To disable strict typing, comment out the directive below. - */ - declare(strict_types=1); class AcronymTest extends PHPUnit\Framework\TestCase @@ -31,41 +9,66 @@ public static function setUpBeforeClass(): void require_once 'Acronym.php'; } + /** + * @testdox Basic + * uuid: 1e22cceb-c5e4-4562-9afe-aef07ad1eaf4 + */ public function testBasicTitleCase(): void { $this->assertEquals('PNG', acronym('Portable Network Graphics')); } + /** + * @testdox Lowercase words + * uuid: 79ae3889-a5c0-4b01-baf0-232d31180c08 + */ public function testLowerCaseWord(): void { $this->assertEquals('ROR', acronym('Ruby on Rails')); } - public function testCamelCase(): void + /** + * @testdox Punctuation + * uuid: ec7000a7-3931-4a17-890e-33ca2073a548 + */ + public function testPunctuation(): void { - $this->assertEquals('HTML', acronym('HyperText Markup Language')); + $this->assertEquals('FIFO', acronym('First In, First Out')); } + /** + * @testdox All caps word + * uuid: 32dd261c-0c92-469a-9c5c-b192e94a63b0 + */ public function testAllCapsWords(): void { - $this->assertEquals('PHP', acronym('PHP: Hypertext Preprocessor')); + $this->assertEquals('GIMP', acronym('GNU Image Manipulation Program')); } + /** + * @testdox Punctuation without whitespace + * uuid: ae2ac9fa-a606-4d05-8244-3bcc4659c1d4 + */ public function testHyphenated(): void { $this->assertEquals('CMOS', acronym('Complementary metal-oxide semiconductor')); } - // Additional points for making the following tests pass - - public function testOneWordIsNotAbbreviated(): void + /** + * @testdox Very long abbreviation + * uuid: 0e4b1e7c-1a6d-48fb-81a7-bf65eb9e69f9 + */ + public function testVeryLongAbbreviation(): void { - $this->assertEmpty(acronym('Word')); + $this->assertEquals('ROTFLSHTMDCOALM', acronym('Rolling On The Floor Laughing So Hard That My Dogs Came Over And Licked Me')); } - public function testUnicode(): void + /** + * @testdox Consecutive delimiters + * uuid: 6a078f49-c68d-4b7b-89af-33a1a98c28cc + */ + public function testConsecutiveDelimiters(): void { - $phrase = 'Специализированная процессорная часть'; - $this->assertEquals('СПЧ', acronym($phrase)); + $this->assertEquals('SIMUFTA', acronym('Something - I made up from thin air')); } }