Skip to content

Commit 00f740e

Browse files
authored
Update problem-specifications (#2073)
1 parent 1f9f9ed commit 00f740e

File tree

7 files changed

+68
-3
lines changed

7 files changed

+68
-3
lines changed

bin/checkout_pinned_problem_specifications_commit.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ set -euo pipefail
33

44
cd "$(git rev-parse --show-toplevel)"
55

6-
PINNED_COMMIT_HASH="1799950ecdc8273426de6426a5bed8c360c9f2c7"
6+
PINNED_COMMIT_HASH="c4043d661357fc2d7ad07b8359adc92d283a5a00"
77

88
dir="$(./bin/get_problem_specifications_dir.sh)"
99

exercises/practice/crypto-square/.meta/tests.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,8 @@ description = "8 character plaintext results in 3 chunks, the last one with a tr
3232

3333
[fbcb0c6d-4c39-4a31-83f6-c473baa6af80]
3434
description = "54 character plaintext results in 7 chunks, the last two with trailing spaces"
35+
include = false
36+
37+
[33fd914e-fa44-445b-8f38-ff8fbc9fe6e6]
38+
description = "54 character plaintext results in 8 chunks, the last two with trailing spaces"
39+
reimplements = "fbcb0c6d-4c39-4a31-83f6-c473baa6af80"

exercises/practice/crypto-square/tests/crypto_square.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ fn test_8_character_plaintext_results_in_3_chunks_the_last_one_with_a_trailing_s
5757

5858
#[test]
5959
#[ignore]
60-
fn test_54_character_plaintext_results_in_7_chunks_the_last_two_with_trailing_spaces() {
60+
fn test_54_character_plaintext_results_in_8_chunks_the_last_two_with_trailing_spaces() {
6161
let actual = encrypt("If man was meant to stay on the ground, god would have given us roots.");
6262
let expected = "imtgdvs fearwer mayoogo anouuio ntnnlvt wttddes aohghn sseoau ";
6363
assert_eq!(&actual, expected);

exercises/practice/largest-series-product/.meta/test_template.tera

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,13 @@ fn return_is_a_result() {
1111
#[ignore]
1212
fn {{ test.description | make_ident }}() {
1313
{% if test.expected.error is defined %}
14-
{% if test.expected.error == "span must be smaller than string length" %}
14+
{% if test.expected.error == "span must not exceed string length" %}
1515
{% set error_type = "SpanTooLong" %}
1616
{% elif test.expected.error == "digits input must only contain digits" %}
1717
{% set invalid_char = test.input.digits | split(pat="") | sort | last %}
1818
{% set error_type = "InvalidDigit('" ~ invalid_char ~ "')" %}
19+
{% else %}
20+
{{ throw(message="unknown error: " ~ test.expected.error) }}
1921
{% endif %}
2022

2123
assert_eq!(Err(Error::{{error_type}}), lsp("{{test.input.digits}}", {{test.input.span}}));

exercises/practice/largest-series-product/.meta/tests.toml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,11 @@ description = "reports zero if all spans include zero"
3838

3939
[5d81aaf7-4f67-4125-bf33-11493cc7eab7]
4040
description = "rejects span longer than string length"
41+
include = false
42+
43+
[0ae1ce53-d9ba-41bb-827f-2fceb64f058b]
44+
description = "rejects span longer than string length"
45+
reimplements = "5d81aaf7-4f67-4125-bf33-11493cc7eab7"
4146

4247
[06bc8b90-0c51-4c54-ac22-3ec3893a079e]
4348
description = "reports 1 for empty string and empty product (0 span)"
@@ -47,6 +52,11 @@ description = "reports 1 for nonempty string and empty product (0 span)"
4752

4853
[6d96c691-4374-4404-80ee-2ea8f3613dd4]
4954
description = "rejects empty string and nonzero span"
55+
include = false
56+
57+
[6cf66098-a6af-4223-aab1-26aeeefc7402]
58+
description = "rejects empty string and nonzero span"
59+
reimplements = "6d96c691-4374-4404-80ee-2ea8f3613dd4"
5060

5161
[7a38f2d6-3c35-45f6-8d6f-12e6e32d4d74]
5262
description = "rejects invalid character in digits"

exercises/practice/wordy/.meta/tests.toml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,21 @@
1212
[88bf4b28-0de3-4883-93c7-db1b14aa806e]
1313
description = "just a number"
1414

15+
[18983214-1dfc-4ebd-ac77-c110dde699ce]
16+
description = "just a zero"
17+
18+
[607c08ee-2241-4288-916d-dae5455c87e6]
19+
description = "just a negative number"
20+
1521
[bb8c655c-cf42-4dfc-90e0-152fcfd8d4e0]
1622
description = "addition"
1723

24+
[bb9f2082-171c-46ad-ad4e-c3f72087c1b5]
25+
description = "addition with a left hand zero"
26+
27+
[6fa05f17-405a-4742-80ae-5d1a8edb0d5d]
28+
description = "addition with a right hand zero"
29+
1830
[79e49e06-c5ae-40aa-a352-7a3a01f70015]
1931
description = "more addition"
2032

exercises/practice/wordy/tests/wordy.rs

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,24 @@ fn just_a_number() {
88
assert_eq!(output, expected);
99
}
1010

11+
#[test]
12+
#[ignore]
13+
fn just_a_zero() {
14+
let input = "What is 0?";
15+
let output = answer(input);
16+
let expected = Some(0);
17+
assert_eq!(output, expected);
18+
}
19+
20+
#[test]
21+
#[ignore]
22+
fn just_a_negative_number() {
23+
let input = "What is -123?";
24+
let output = answer(input);
25+
let expected = Some(-123);
26+
assert_eq!(output, expected);
27+
}
28+
1129
#[test]
1230
#[ignore]
1331
fn addition() {
@@ -17,6 +35,24 @@ fn addition() {
1735
assert_eq!(output, expected);
1836
}
1937

38+
#[test]
39+
#[ignore]
40+
fn addition_with_a_left_hand_zero() {
41+
let input = "What is 0 plus 2?";
42+
let output = answer(input);
43+
let expected = Some(2);
44+
assert_eq!(output, expected);
45+
}
46+
47+
#[test]
48+
#[ignore]
49+
fn addition_with_a_right_hand_zero() {
50+
let input = "What is 3 plus 0?";
51+
let output = answer(input);
52+
let expected = Some(3);
53+
assert_eq!(output, expected);
54+
}
55+
2056
#[test]
2157
#[ignore]
2258
fn more_addition() {

0 commit comments

Comments
 (0)