Skip to content
This repository has been archived by the owner on Sep 27, 2018. It is now read-only.

Commit

Permalink
Clarified README.md and added tests for jaggedness requirement. Fixes…
Browse files Browse the repository at this point in the history
… issue exercism#458
  • Loading branch information
Thornton authored and Thornton committed Mar 12, 2018
1 parent 77d4388 commit 64e0eb7
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
7 changes: 4 additions & 3 deletions exercises/crypto-square/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 8 additions & 0 deletions exercises/crypto-square/tests/crypto-square.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down

0 comments on commit 64e0eb7

Please sign in to comment.