From a7d5f2e6943e8a46485ae41b9429164740f3d9ce Mon Sep 17 00:00:00 2001 From: Eric Willigers Date: Sat, 1 Nov 2025 06:39:44 +1100 Subject: [PATCH] Sync exercises --- .../practice/flower-field/.meta/tests.toml | 3 ++ .../flower-field/flower-field-test.el | 6 +++ .../practice/isbn-verifier/.meta/tests.toml | 6 +++ .../isbn-verifier/isbn-verifier-test.el | 10 +++- .../practice/line-up/.docs/instructions.md | 6 +-- exercises/practice/say/.docs/instructions.md | 52 +++---------------- exercises/practice/say/.docs/introduction.md | 6 +++ .../practice/triangle/.docs/instructions.md | 6 +++ 8 files changed, 47 insertions(+), 48 deletions(-) create mode 100644 exercises/practice/say/.docs/introduction.md diff --git a/exercises/practice/flower-field/.meta/tests.toml b/exercises/practice/flower-field/.meta/tests.toml index c2b24fda..965ba8fd 100644 --- a/exercises/practice/flower-field/.meta/tests.toml +++ b/exercises/practice/flower-field/.meta/tests.toml @@ -44,3 +44,6 @@ description = "cross" [dd9d4ca8-9e68-4f78-a677-a2a70fd7a7b8] description = "large garden" + +[6e4ac13a-3e43-4728-a2e3-3551d4b1a996] +description = "multiple adjacent flowers" diff --git a/exercises/practice/flower-field/flower-field-test.el b/exercises/practice/flower-field/flower-field-test.el index 3f4e64a2..0f5ece0f 100644 --- a/exercises/practice/flower-field/flower-field-test.el +++ b/exercises/practice/flower-field/flower-field-test.el @@ -131,5 +131,11 @@ " "))))) +(ert-deftest multiple-adjacent-flowers () + (should (equal '("1**1") + + (annotate '(" ** "))))) + + (provide 'flower-field-test) ;;; flower-field-test.el ends here diff --git a/exercises/practice/isbn-verifier/.meta/tests.toml b/exercises/practice/isbn-verifier/.meta/tests.toml index 6d5a8459..17e18d47 100644 --- a/exercises/practice/isbn-verifier/.meta/tests.toml +++ b/exercises/practice/isbn-verifier/.meta/tests.toml @@ -30,6 +30,12 @@ description = "invalid character in isbn is not treated as zero" [28025280-2c39-4092-9719-f3234b89c627] description = "X is only valid as a check digit" +[8005b57f-f194-44ee-88d2-a77ac4142591] +description = "only one check digit is allowed" + +[fdb14c99-4cf8-43c5-b06d-eb1638eff343] +description = "X is not substituted by the value 10" + [f6294e61-7e79-46b3-977b-f48789a4945b] description = "valid isbn without separating dashes" diff --git a/exercises/practice/isbn-verifier/isbn-verifier-test.el b/exercises/practice/isbn-verifier/isbn-verifier-test.el index c11efa47..4b6f16d1 100644 --- a/exercises/practice/isbn-verifier/isbn-verifier-test.el +++ b/exercises/practice/isbn-verifier/isbn-verifier-test.el @@ -1,4 +1,4 @@ -;;; isbn-verifier-test.el --- Tests for Isbn Verifier (exercism) -*- lexical-binding: t; -*- +;;; isbn-verifier-test.el --- Tests for ISBN Verifier (exercism) -*- lexical-binding: t; -*- ;;; Commentary: @@ -36,6 +36,14 @@ (should-not (validp "3-598-2X507-9"))) +(ert-deftest only-one-check-digit-is-allowed () + (should-not (validp "3-598-21508-96"))) + + +(ert-deftest x-is-not-substituted-by-the-value-10 () + (should-not (validp "3-598-2X507-5"))) + + (ert-deftest valid-isbn-without-separating-dashes () (should (validp "3598215088"))) diff --git a/exercises/practice/line-up/.docs/instructions.md b/exercises/practice/line-up/.docs/instructions.md index fb41d4cb..9e686ecb 100644 --- a/exercises/practice/line-up/.docs/instructions.md +++ b/exercises/practice/line-up/.docs/instructions.md @@ -5,9 +5,9 @@ Yaʻqūb expects to use numbers from 1 up to 999. Rules: -- Numbers ending in 1 (except for 11) → `"st"` -- Numbers ending in 2 (except for 12) → `"nd"` -- Numbers ending in 3 (except for 13) → `"rd"` +- Numbers ending in 1 (unless ending in 11) → `"st"` +- Numbers ending in 2 (unless ending in 12) → `"nd"` +- Numbers ending in 3 (unless ending in 13) → `"rd"` - All other numbers → `"th"` Examples: diff --git a/exercises/practice/say/.docs/instructions.md b/exercises/practice/say/.docs/instructions.md index ad3d3477..3251c519 100644 --- a/exercises/practice/say/.docs/instructions.md +++ b/exercises/practice/say/.docs/instructions.md @@ -1,48 +1,12 @@ # Instructions -Given a number from 0 to 999,999,999,999, spell out that number in English. +Given a number, your task is to express it in English words exactly as your friend should say it out loud. +Yaʻqūb expects to use numbers from 0 up to 999,999,999,999. -## Step 1 +Examples: -Handle the basic case of 0 through 99. - -If the input to the program is `22`, then the output should be `'twenty-two'`. - -Your program should complain loudly if given a number outside the blessed range. - -Some good test cases for this program are: - -- 0 -- 14 -- 50 -- 98 -- -1 -- 100 - -### Extension - -If you're on a Mac, shell out to Mac OS X's `say` program to talk out loud. -If you're on Linux or Windows, eSpeakNG may be available with the command `espeak`. - -## Step 2 - -Implement breaking a number up into chunks of thousands. - -So `1234567890` should yield a list like 1, 234, 567, and 890, while the far simpler `1000` should yield just 1 and 0. - -## Step 3 - -Now handle inserting the appropriate scale word between those chunks. - -So `1234567890` should yield `'1 billion 234 million 567 thousand 890'` - -The program must also report any values that are out of range. -It's fine to stop at "trillion". - -## Step 4 - -Put it all together to get nothing but plain English. - -`12345` should give `twelve thousand three hundred forty-five`. - -The program must also report any values that are out of range. +- 0 → zero +- 1 → one +- 12 → twelve +- 123 → one hundred twenty-three +- 1,234 → one thousand two hundred thirty-four diff --git a/exercises/practice/say/.docs/introduction.md b/exercises/practice/say/.docs/introduction.md new file mode 100644 index 00000000..abd22851 --- /dev/null +++ b/exercises/practice/say/.docs/introduction.md @@ -0,0 +1,6 @@ +# Introduction + +Your friend Yaʻqūb works the counter at the busiest deli in town, slicing, weighing, and wrapping orders for a never-ending line of hungry customers. +To keep things moving, each customer takes a numbered ticket when they arrive. + +When it’s time to call the next person, Yaʻqūb reads their number out loud, always in full English words to make sure everyone hears it clearly. diff --git a/exercises/practice/triangle/.docs/instructions.md b/exercises/practice/triangle/.docs/instructions.md index ac390087..e9b053dc 100644 --- a/exercises/practice/triangle/.docs/instructions.md +++ b/exercises/practice/triangle/.docs/instructions.md @@ -13,6 +13,12 @@ A _scalene_ triangle has all sides of different lengths. For a shape to be a triangle at all, all sides have to be of length > 0, and the sum of the lengths of any two sides must be greater than or equal to the length of the third side. +~~~~exercism/note +_Degenerate triangles_ are triangles where the sum of the length of two sides is **equal** to the length of the third side, e.g. `1, 1, 2`. +We opted to not include tests for degenerate triangles in this exercise. +You may handle those situations if you wish to do so, or safely ignore them. +~~~~ + In equations: Let `a`, `b`, and `c` be sides of the triangle.