diff --git a/exercises/crypto-square/README.md b/exercises/crypto-square/README.md index c1c6dba93..07830ff53 100644 --- a/exercises/crypto-square/README.md +++ b/exercises/crypto-square/README.md @@ -47,9 +47,10 @@ imtgdvsfearwermayoogoanouuiontnnlvtwttddesaohghnsseoau Output the encoded text in chunks. Phrases that fill perfect rectangles `(r X c)` should be output `c` chunks of `r` length, separated by spaces. -Phrases that do not fill perfect rectangles will have `n` empty spaces. -Those spaces should be distributed evenly, added to the end of the last -`n` chunks. +Phrases that do not fill perfect rectangles will be `n` characters short. +To minimize the jaggedness, the missing chars should be distributed evenly, +added to the end of the last `n` chunks. The bottom row(s) should be, at most, +one char short of the top row(s). ```text imtgdvs fearwer mayoogo anouuio ntnnlvt wttddes aohghn sseoau diff --git a/exercises/crypto-square/tests/crypto-square.rs b/exercises/crypto-square/tests/crypto-square.rs index 087de1b60..20d41851d 100644 --- a/exercises/crypto-square/tests/crypto-square.rs +++ b/exercises/crypto-square/tests/crypto-square.rs @@ -63,6 +63,14 @@ fn test_ignore_non_ascii_chars() { ); } +#[test] +#[ignore] +fn test_minimize_jaggedness() { + test("aaaa bbbb cccc d", "abcd abc abc abc"); + test("aaaa bbbb cccc dd", "abcd abcd abc abc"); + test("aaaa bbbb cccc ddd", "abcd abcd abcd abc"); +} + #[test] #[ignore] fn test_long() {