From e42db9b5e6101b3a42b0ed8d0c18a174bd158326 Mon Sep 17 00:00:00 2001 From: rbasso Date: Tue, 7 Mar 2017 23:14:36 +0900 Subject: [PATCH 1/2] crypto-square: Make canonical-data.json compliant --- exercises/crypto-square/canonical-data.json | 24 +++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/exercises/crypto-square/canonical-data.json b/exercises/crypto-square/canonical-data.json index 3b0a0bbfaa..ddb9f4dd72 100644 --- a/exercises/crypto-square/canonical-data.json +++ b/exercises/crypto-square/canonical-data.json @@ -1,34 +1,42 @@ { - "normalized_plaintext": { + "exercise": "crypto-square", + "version": "1.0.0", + "cases": [ + { "description": "the spaces and punctuation are removed from the English text and the message is downcased", "cases": [ { "description": "Lowercase", + "property": "normalizedPlaintext", "plaintext": "Hello", "expected": "hello" }, { "description": "Remove spaces", + "property": "normalizedPlaintext", "plaintext": "Hi there", "expected": "hithere" }, { "description": "Remove punctuation", + "property": "normalizedPlaintext", "plaintext": "@1, 2%, 3 Go!", "expected": "123go" } ] }, - "plaintext_segments": { + { "description": "The plaintext should be organized in to a rectangle. The size of the rectangle (`r x c`) should be decided by the length of the message, such that `c >= r` and `c - r <= 1`, where `c` is the number of columns and `r` is the number of rows.", "cases": [ { "description": "empty plaintext results in an empty rectangle", + "property": "plaintextSegments", "plaintext": "", "expected": "[]" }, { "description": "4 character plaintext results in an 2x2 rectangle", + "property": "plaintextSegments", "plaintext": "Ab Cd", "expected": [ "ab", @@ -37,6 +45,7 @@ }, { "description": "9 character plaintext results in an 3x3 rectangle", + "property": "plaintextSegments", "plaintext": "This is fun!", "expected": [ "thi", @@ -46,6 +55,7 @@ }, { "description": "54 character plaintext results in an 8x7 rectangle", + "property": "plaintextSegments", "plaintext": "If man was meant to stay on the ground, god would have given us roots.", "expected": [ "ifmanwas", @@ -59,39 +69,45 @@ } ] }, - "encoded": { + { "description": "The coded message is obtained by reading down the columns going left to right.", "cases": [ { "description": "empty plaintext results in an empty encode", + "property": "encoded", "plaintext": "", "expected": "" }, { "description": "Non-empty plaintext results in the combined plaintext segments", + "property": "encoded", "plaintext": "If man was meant to stay on the ground, god would have given us roots.", "expected": "imtgdvsfearwermayoogoanouuiontnnlvtwttddesaohghnsseoau" } ] }, - "ciphertext": { + { "description": "Output the encoded text in chunks. Phrases that fill perfect squares `(r X r)` should be output in `r`-length chunks separated by spaces. Imperfect squares will have `n` empty spaces. Those spaces should be distributed evenly across the last `n` rows.", "cases": [ { "description": "empty plaintext results in an empty ciphertext", + "property": "ciphertext", "plaintext": "", "expected": "" }, { "description": "9 character plaintext results in 3 chunks of 3 characters", + "property": "ciphertext", "plaintext": "This is fun!", "expected": "tsf hiu isn" }, { "description": "54 character plaintext results in 7 chunks, the last two padded with spaces", + "property": "ciphertext", "plaintext": "If man was meant to stay on the ground, god would have given us roots.", "expected": "imtgdvs fearwer mayoogo anouuio ntnnlvt wttddes aohghn sseoau " } ] } + ] } From d4fc082af8c01de684f899e750ad2f28d1d9fec6 Mon Sep 17 00:00:00 2001 From: rbasso Date: Tue, 7 Mar 2017 23:17:47 +0900 Subject: [PATCH 2/2] crypto-square: Fix canonical-data.json formatting --- exercises/crypto-square/canonical-data.json | 208 ++++++++++---------- 1 file changed, 101 insertions(+), 107 deletions(-) diff --git a/exercises/crypto-square/canonical-data.json b/exercises/crypto-square/canonical-data.json index ddb9f4dd72..420f135581 100644 --- a/exercises/crypto-square/canonical-data.json +++ b/exercises/crypto-square/canonical-data.json @@ -2,112 +2,106 @@ "exercise": "crypto-square", "version": "1.0.0", "cases": [ - { - "description": "the spaces and punctuation are removed from the English text and the message is downcased", - "cases": [ - { - "description": "Lowercase", - "property": "normalizedPlaintext", - "plaintext": "Hello", - "expected": "hello" - }, - { - "description": "Remove spaces", - "property": "normalizedPlaintext", - "plaintext": "Hi there", - "expected": "hithere" - }, - { - "description": "Remove punctuation", - "property": "normalizedPlaintext", - "plaintext": "@1, 2%, 3 Go!", - "expected": "123go" - } - ] - }, - { - "description": "The plaintext should be organized in to a rectangle. The size of the rectangle (`r x c`) should be decided by the length of the message, such that `c >= r` and `c - r <= 1`, where `c` is the number of columns and `r` is the number of rows.", - "cases": [ - { - "description": "empty plaintext results in an empty rectangle", - "property": "plaintextSegments", - "plaintext": "", - "expected": "[]" - }, - { - "description": "4 character plaintext results in an 2x2 rectangle", - "property": "plaintextSegments", - "plaintext": "Ab Cd", - "expected": [ - "ab", - "cd" - ] - }, - { - "description": "9 character plaintext results in an 3x3 rectangle", - "property": "plaintextSegments", - "plaintext": "This is fun!", - "expected": [ - "thi", - "sis", - "fun" - ] - }, - { - "description": "54 character plaintext results in an 8x7 rectangle", - "property": "plaintextSegments", - "plaintext": "If man was meant to stay on the ground, god would have given us roots.", - "expected": [ - "ifmanwas", - "meanttos", - "tayonthe", - "groundgo", - "dwouldha", - "vegivenu", - "sroots" - ] - } - ] - }, - { - "description": "The coded message is obtained by reading down the columns going left to right.", - "cases": [ - { - "description": "empty plaintext results in an empty encode", - "property": "encoded", - "plaintext": "", - "expected": "" - }, - { - "description": "Non-empty plaintext results in the combined plaintext segments", - "property": "encoded", - "plaintext": "If man was meant to stay on the ground, god would have given us roots.", - "expected": "imtgdvsfearwermayoogoanouuiontnnlvtwttddesaohghnsseoau" - } - ] - }, - { - "description": "Output the encoded text in chunks. Phrases that fill perfect squares `(r X r)` should be output in `r`-length chunks separated by spaces. Imperfect squares will have `n` empty spaces. Those spaces should be distributed evenly across the last `n` rows.", - "cases": [ - { - "description": "empty plaintext results in an empty ciphertext", - "property": "ciphertext", - "plaintext": "", - "expected": "" - }, - { - "description": "9 character plaintext results in 3 chunks of 3 characters", - "property": "ciphertext", - "plaintext": "This is fun!", - "expected": "tsf hiu isn" - }, - { - "description": "54 character plaintext results in 7 chunks, the last two padded with spaces", - "property": "ciphertext", - "plaintext": "If man was meant to stay on the ground, god would have given us roots.", - "expected": "imtgdvs fearwer mayoogo anouuio ntnnlvt wttddes aohghn sseoau " - } - ] - } + { + "description": "the spaces and punctuation are removed from the English text and the message is downcased", + "cases": [ + { + "description": "Lowercase", + "property": "normalizedPlaintext", + "plaintext": "Hello", + "expected": "hello" + }, + { + "description": "Remove spaces", + "property": "normalizedPlaintext", + "plaintext": "Hi there", + "expected": "hithere" + }, + { + "description": "Remove punctuation", + "property": "normalizedPlaintext", + "plaintext": "@1, 2%, 3 Go!", + "expected": "123go" + } + ] + }, + { + "description": "The plaintext should be organized in to a rectangle. The size of the rectangle (`r x c`) should be decided by the length of the message, such that `c >= r` and `c - r <= 1`, where `c` is the number of columns and `r` is the number of rows.", + "cases": [ + { + "description": "empty plaintext results in an empty rectangle", + "property": "plaintextSegments", + "plaintext": "", + "expected": "[]" + }, + { + "description": "4 character plaintext results in an 2x2 rectangle", + "property": "plaintextSegments", + "plaintext": "Ab Cd", + "expected": [ "ab", + "cd" ] + }, + { + "description": "9 character plaintext results in an 3x3 rectangle", + "property": "plaintextSegments", + "plaintext": "This is fun!", + "expected": [ "thi", + "sis", + "fun" ] + }, + { + "description": "54 character plaintext results in an 8x7 rectangle", + "property": "plaintextSegments", + "plaintext": "If man was meant to stay on the ground, god would have given us roots.", + "expected": [ "ifmanwas", + "meanttos", + "tayonthe", + "groundgo", + "dwouldha", + "vegivenu", + "sroots" ] + } + ] + }, + { + "description": "The coded message is obtained by reading down the columns going left to right.", + "cases": [ + { + "description": "empty plaintext results in an empty encode", + "property": "encoded", + "plaintext": "", + "expected": "" + }, + { + "description": "Non-empty plaintext results in the combined plaintext segments", + "property": "encoded", + "plaintext": "If man was meant to stay on the ground, god would have given us roots.", + "expected": "imtgdvsfearwermayoogoanouuiontnnlvtwttddesaohghnsseoau" + } + ] + }, + { + "description": "Output the encoded text in chunks. Phrases that fill perfect squares `(r X r)` should be output in `r`-length chunks separated by spaces. Imperfect squares will have `n` empty spaces. Those spaces should be distributed evenly across the last `n` rows.", + "cases": [ + { + "description": "empty plaintext results in an empty ciphertext", + "property": "ciphertext", + "plaintext": "", + "expected": "" + }, + { + "description": "9 character plaintext results in 3 chunks of 3 characters", + "property": "ciphertext", + "plaintext": "This is fun!", + "expected": "tsf hiu isn" + }, + { + "description": "54 character plaintext results in 7 chunks, the last two padded with spaces", + "property": "ciphertext", + "plaintext": "If man was meant to stay on the ground, god would have given us roots.", + "expected": "imtgdvs fearwer mayoogo anouuio ntnnlvt wttddes aohghn sseoau " + } + ] + } ] }