Skip to content

Update problem-specifications #2073

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 26, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion bin/checkout_pinned_problem_specifications_commit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ set -euo pipefail

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

PINNED_COMMIT_HASH="1799950ecdc8273426de6426a5bed8c360c9f2c7"
PINNED_COMMIT_HASH="c4043d661357fc2d7ad07b8359adc92d283a5a00"

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

Expand Down
5 changes: 5 additions & 0 deletions exercises/practice/crypto-square/.meta/tests.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,8 @@ description = "8 character plaintext results in 3 chunks, the last one with a tr

[fbcb0c6d-4c39-4a31-83f6-c473baa6af80]
description = "54 character plaintext results in 7 chunks, the last two with trailing spaces"
include = false

[33fd914e-fa44-445b-8f38-ff8fbc9fe6e6]
description = "54 character plaintext results in 8 chunks, the last two with trailing spaces"
reimplements = "fbcb0c6d-4c39-4a31-83f6-c473baa6af80"
2 changes: 1 addition & 1 deletion exercises/practice/crypto-square/tests/crypto_square.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ fn test_8_character_plaintext_results_in_3_chunks_the_last_one_with_a_trailing_s

#[test]
#[ignore]
fn test_54_character_plaintext_results_in_7_chunks_the_last_two_with_trailing_spaces() {
fn test_54_character_plaintext_results_in_8_chunks_the_last_two_with_trailing_spaces() {
let actual = encrypt("If man was meant to stay on the ground, god would have given us roots.");
let expected = "imtgdvs fearwer mayoogo anouuio ntnnlvt wttddes aohghn sseoau ";
assert_eq!(&actual, expected);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,13 @@ fn return_is_a_result() {
#[ignore]
fn {{ test.description | make_ident }}() {
{% if test.expected.error is defined %}
{% if test.expected.error == "span must be smaller than string length" %}
{% if test.expected.error == "span must not exceed string length" %}
{% set error_type = "SpanTooLong" %}
{% elif test.expected.error == "digits input must only contain digits" %}
{% set invalid_char = test.input.digits | split(pat="") | sort | last %}
{% set error_type = "InvalidDigit('" ~ invalid_char ~ "')" %}
{% else %}
{{ throw(message="unknown error: " ~ test.expected.error) }}
{% endif %}

assert_eq!(Err(Error::{{error_type}}), lsp("{{test.input.digits}}", {{test.input.span}}));
Expand Down
10 changes: 10 additions & 0 deletions exercises/practice/largest-series-product/.meta/tests.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@ description = "reports zero if all spans include zero"

[5d81aaf7-4f67-4125-bf33-11493cc7eab7]
description = "rejects span longer than string length"
include = false

[0ae1ce53-d9ba-41bb-827f-2fceb64f058b]
description = "rejects span longer than string length"
reimplements = "5d81aaf7-4f67-4125-bf33-11493cc7eab7"

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

[6d96c691-4374-4404-80ee-2ea8f3613dd4]
description = "rejects empty string and nonzero span"
include = false

[6cf66098-a6af-4223-aab1-26aeeefc7402]
description = "rejects empty string and nonzero span"
reimplements = "6d96c691-4374-4404-80ee-2ea8f3613dd4"

[7a38f2d6-3c35-45f6-8d6f-12e6e32d4d74]
description = "rejects invalid character in digits"
Expand Down
12 changes: 12 additions & 0 deletions exercises/practice/wordy/.meta/tests.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,21 @@
[88bf4b28-0de3-4883-93c7-db1b14aa806e]
description = "just a number"

[18983214-1dfc-4ebd-ac77-c110dde699ce]
description = "just a zero"

[607c08ee-2241-4288-916d-dae5455c87e6]
description = "just a negative number"

[bb8c655c-cf42-4dfc-90e0-152fcfd8d4e0]
description = "addition"

[bb9f2082-171c-46ad-ad4e-c3f72087c1b5]
description = "addition with a left hand zero"

[6fa05f17-405a-4742-80ae-5d1a8edb0d5d]
description = "addition with a right hand zero"

[79e49e06-c5ae-40aa-a352-7a3a01f70015]
description = "more addition"

Expand Down
36 changes: 36 additions & 0 deletions exercises/practice/wordy/tests/wordy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,24 @@ fn just_a_number() {
assert_eq!(output, expected);
}

#[test]
#[ignore]
fn just_a_zero() {
let input = "What is 0?";
let output = answer(input);
let expected = Some(0);
assert_eq!(output, expected);
}

#[test]
#[ignore]
fn just_a_negative_number() {
let input = "What is -123?";
let output = answer(input);
let expected = Some(-123);
assert_eq!(output, expected);
}

#[test]
#[ignore]
fn addition() {
Expand All @@ -17,6 +35,24 @@ fn addition() {
assert_eq!(output, expected);
}

#[test]
#[ignore]
fn addition_with_a_left_hand_zero() {
let input = "What is 0 plus 2?";
let output = answer(input);
let expected = Some(2);
assert_eq!(output, expected);
}

#[test]
#[ignore]
fn addition_with_a_right_hand_zero() {
let input = "What is 3 plus 0?";
let output = answer(input);
let expected = Some(3);
assert_eq!(output, expected);
}

#[test]
#[ignore]
fn more_addition() {
Expand Down