Skip to content

Commit 85e5b5d

Browse files
Sync exercises (#504)
1 parent f271281 commit 85e5b5d

File tree

8 files changed

+47
-48
lines changed

8 files changed

+47
-48
lines changed

exercises/practice/flower-field/.meta/tests.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,3 +44,6 @@ description = "cross"
4444

4545
[dd9d4ca8-9e68-4f78-a677-a2a70fd7a7b8]
4646
description = "large garden"
47+
48+
[6e4ac13a-3e43-4728-a2e3-3551d4b1a996]
49+
description = "multiple adjacent flowers"

exercises/practice/flower-field/flower-field-test.el

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,5 +131,11 @@
131131
" ")))))
132132

133133

134+
(ert-deftest multiple-adjacent-flowers ()
135+
(should (equal '("1**1")
136+
137+
(annotate '(" ** ")))))
138+
139+
134140
(provide 'flower-field-test)
135141
;;; flower-field-test.el ends here

exercises/practice/isbn-verifier/.meta/tests.toml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,12 @@ description = "invalid character in isbn is not treated as zero"
3030
[28025280-2c39-4092-9719-f3234b89c627]
3131
description = "X is only valid as a check digit"
3232

33+
[8005b57f-f194-44ee-88d2-a77ac4142591]
34+
description = "only one check digit is allowed"
35+
36+
[fdb14c99-4cf8-43c5-b06d-eb1638eff343]
37+
description = "X is not substituted by the value 10"
38+
3339
[f6294e61-7e79-46b3-977b-f48789a4945b]
3440
description = "valid isbn without separating dashes"
3541

exercises/practice/isbn-verifier/isbn-verifier-test.el

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
;;; isbn-verifier-test.el --- Tests for Isbn Verifier (exercism) -*- lexical-binding: t; -*-
1+
;;; isbn-verifier-test.el --- Tests for ISBN Verifier (exercism) -*- lexical-binding: t; -*-
22

33
;;; Commentary:
44

@@ -36,6 +36,14 @@
3636
(should-not (validp "3-598-2X507-9")))
3737

3838

39+
(ert-deftest only-one-check-digit-is-allowed ()
40+
(should-not (validp "3-598-21508-96")))
41+
42+
43+
(ert-deftest x-is-not-substituted-by-the-value-10 ()
44+
(should-not (validp "3-598-2X507-5")))
45+
46+
3947
(ert-deftest valid-isbn-without-separating-dashes ()
4048
(should (validp "3598215088")))
4149

exercises/practice/line-up/.docs/instructions.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ Yaʻqūb expects to use numbers from 1 up to 999.
55

66
Rules:
77

8-
- Numbers ending in 1 (except for 11) → `"st"`
9-
- Numbers ending in 2 (except for 12) → `"nd"`
10-
- Numbers ending in 3 (except for 13) → `"rd"`
8+
- Numbers ending in 1 (unless ending in 11) → `"st"`
9+
- Numbers ending in 2 (unless ending in 12) → `"nd"`
10+
- Numbers ending in 3 (unless ending in 13) → `"rd"`
1111
- All other numbers → `"th"`
1212

1313
Examples:
Lines changed: 8 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,12 @@
11
# Instructions
22

3-
Given a number from 0 to 999,999,999,999, spell out that number in English.
3+
Given a number, your task is to express it in English words exactly as your friend should say it out loud.
4+
Yaʻqūb expects to use numbers from 0 up to 999,999,999,999.
45

5-
## Step 1
6+
Examples:
67

7-
Handle the basic case of 0 through 99.
8-
9-
If the input to the program is `22`, then the output should be `'twenty-two'`.
10-
11-
Your program should complain loudly if given a number outside the blessed range.
12-
13-
Some good test cases for this program are:
14-
15-
- 0
16-
- 14
17-
- 50
18-
- 98
19-
- -1
20-
- 100
21-
22-
### Extension
23-
24-
If you're on a Mac, shell out to Mac OS X's `say` program to talk out loud.
25-
If you're on Linux or Windows, eSpeakNG may be available with the command `espeak`.
26-
27-
## Step 2
28-
29-
Implement breaking a number up into chunks of thousands.
30-
31-
So `1234567890` should yield a list like 1, 234, 567, and 890, while the far simpler `1000` should yield just 1 and 0.
32-
33-
## Step 3
34-
35-
Now handle inserting the appropriate scale word between those chunks.
36-
37-
So `1234567890` should yield `'1 billion 234 million 567 thousand 890'`
38-
39-
The program must also report any values that are out of range.
40-
It's fine to stop at "trillion".
41-
42-
## Step 4
43-
44-
Put it all together to get nothing but plain English.
45-
46-
`12345` should give `twelve thousand three hundred forty-five`.
47-
48-
The program must also report any values that are out of range.
8+
- 0 → zero
9+
- 1 → one
10+
- 12 → twelve
11+
- 123 → one hundred twenty-three
12+
- 1,234 → one thousand two hundred thirty-four
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Introduction
2+
3+
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.
4+
To keep things moving, each customer takes a numbered ticket when they arrive.
5+
6+
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.

exercises/practice/triangle/.docs/instructions.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,12 @@ A _scalene_ triangle has all sides of different lengths.
1313

1414
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.
1515

16+
~~~~exercism/note
17+
_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`.
18+
We opted to not include tests for degenerate triangles in this exercise.
19+
You may handle those situations if you wish to do so, or safely ignore them.
20+
~~~~
21+
1622
In equations:
1723

1824
Let `a`, `b`, and `c` be sides of the triangle.

0 commit comments

Comments
 (0)