Skip to content

Commit a44a26f

Browse files
Sync exercises
1 parent e7e12db commit a44a26f

File tree

7 files changed

+48
-2
lines changed

7 files changed

+48
-2
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.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,18 @@ void test_large_garden(void) {
205205
TEST_ASSERT_EQUAL_STRING(expected, buffer);
206206
}
207207

208+
void test_multiple_adjacent_flowers(void) {
209+
TEST_IGNORE();
210+
const char *garden =
211+
" ** \n";
212+
const char *expected =
213+
"1**1\n";
214+
char buffer[BUFFER_SIZE];
215+
216+
annotate(buffer, garden);
217+
TEST_ASSERT_EQUAL_STRING(expected, buffer);
218+
}
219+
208220
int main(void) {
209221
UNITY_BEGIN();
210222
RUN_TEST(test_no_rows);
@@ -219,5 +231,6 @@ int main(void) {
219231
RUN_TEST(test_vertical_line_flowers_at_edges);
220232
RUN_TEST(test_cross);
221233
RUN_TEST(test_large_garden);
234+
RUN_TEST(test_multiple_adjacent_flowers);
222235
return UNITY_END();
223236
}

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.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,16 @@ void test_x_is_only_valid_as_a_check_digit(void) {
4242
TEST_ASSERT_FALSE(is_valid("3-598-2X507-9"));
4343
}
4444

45+
void test_only_one_check_digit_is_allowed(void) {
46+
TEST_IGNORE();
47+
TEST_ASSERT_FALSE(is_valid("3-598-21508-96"));
48+
}
49+
50+
void test_x_is_not_substituted_by_the_value_10(void) {
51+
TEST_IGNORE();
52+
TEST_ASSERT_FALSE(is_valid("3-598-2X507-5"));
53+
}
54+
4555
void test_valid_isbn_without_separating_dashes(void) {
4656
TEST_IGNORE();
4757
TEST_ASSERT_TRUE(is_valid("3598215088"));
@@ -111,6 +121,8 @@ int main(void) {
111121
RUN_TEST(test_invalid_check_digit_in_isbn_is_not_treated_as_zero);
112122
RUN_TEST(test_invalid_character_in_isbn_is_not_treated_as_zero);
113123
RUN_TEST(test_x_is_only_valid_as_a_check_digit);
124+
RUN_TEST(test_only_one_check_digit_is_allowed);
125+
RUN_TEST(test_x_is_not_substituted_by_the_value_10);
114126
RUN_TEST(test_valid_isbn_without_separating_dashes);
115127
RUN_TEST(test_isbn_without_separating_dashes_and_x_as_check_digit);
116128
RUN_TEST(test_isbn_without_check_digit_and_dashes);

exercises/practice/luhn/.docs/instructions.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ If the sum is evenly divisible by 10, the original number is valid.
4141

4242
### Invalid Canadian SIN
4343

44-
The number to be checked is `066 123 468`.
44+
The number to be checked is `066 123 478`.
4545

4646
We start at the end of the number and double every second digit, beginning with the second digit from the right and moving left.
4747

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.

generators/generate

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,13 @@ import re
77
import subprocess
88
import sys
99
import textwrap
10-
import tomllib
10+
11+
# tomllib is available in the standard library as of Python 3.11
12+
# When using an older release, we use the compatible tomli
13+
try:
14+
import tomllib
15+
except ModuleNotFoundError:
16+
import tomli as tomllib
1117

1218

1319
def camel_to_snake(s):

0 commit comments

Comments
 (0)