From 16de3c277c4096fd8f306683c9098feef5565625 Mon Sep 17 00:00:00 2001 From: Remo Senekowitsch Date: Wed, 25 Jun 2025 19:49:59 +0200 Subject: [PATCH] Update problem-specifications --- ...ut_pinned_problem_specifications_commit.sh | 2 +- .../practice/crypto-square/.meta/tests.toml | 5 +++ .../crypto-square/tests/crypto_square.rs | 2 +- .../.meta/test_template.tera | 4 ++- .../largest-series-product/.meta/tests.toml | 10 ++++++ exercises/practice/wordy/.meta/tests.toml | 12 +++++++ exercises/practice/wordy/tests/wordy.rs | 36 +++++++++++++++++++ 7 files changed, 68 insertions(+), 3 deletions(-) diff --git a/bin/checkout_pinned_problem_specifications_commit.sh b/bin/checkout_pinned_problem_specifications_commit.sh index b59466798..b98e4c3b2 100755 --- a/bin/checkout_pinned_problem_specifications_commit.sh +++ b/bin/checkout_pinned_problem_specifications_commit.sh @@ -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)" diff --git a/exercises/practice/crypto-square/.meta/tests.toml b/exercises/practice/crypto-square/.meta/tests.toml index 085d142ea..94ef0819f 100644 --- a/exercises/practice/crypto-square/.meta/tests.toml +++ b/exercises/practice/crypto-square/.meta/tests.toml @@ -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" diff --git a/exercises/practice/crypto-square/tests/crypto_square.rs b/exercises/practice/crypto-square/tests/crypto_square.rs index 7fac9531f..dd12dc922 100644 --- a/exercises/practice/crypto-square/tests/crypto_square.rs +++ b/exercises/practice/crypto-square/tests/crypto_square.rs @@ -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); diff --git a/exercises/practice/largest-series-product/.meta/test_template.tera b/exercises/practice/largest-series-product/.meta/test_template.tera index 5fbeb4d91..46a74e3d4 100644 --- a/exercises/practice/largest-series-product/.meta/test_template.tera +++ b/exercises/practice/largest-series-product/.meta/test_template.tera @@ -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}})); diff --git a/exercises/practice/largest-series-product/.meta/tests.toml b/exercises/practice/largest-series-product/.meta/tests.toml index 01f67feb3..b6416b5a0 100644 --- a/exercises/practice/largest-series-product/.meta/tests.toml +++ b/exercises/practice/largest-series-product/.meta/tests.toml @@ -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)" @@ -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" diff --git a/exercises/practice/wordy/.meta/tests.toml b/exercises/practice/wordy/.meta/tests.toml index f812dfa98..a0a83ed0b 100644 --- a/exercises/practice/wordy/.meta/tests.toml +++ b/exercises/practice/wordy/.meta/tests.toml @@ -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" diff --git a/exercises/practice/wordy/tests/wordy.rs b/exercises/practice/wordy/tests/wordy.rs index 6d5ded615..86b565c22 100644 --- a/exercises/practice/wordy/tests/wordy.rs +++ b/exercises/practice/wordy/tests/wordy.rs @@ -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() { @@ -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() {