From aea2b02fdd8a9aa6b805eb790527f3f46e26368c Mon Sep 17 00:00:00 2001 From: Aos Date: Fri, 20 Oct 2017 17:53:59 -0400 Subject: [PATCH 1/3] Added canonical data for simple cipher --- exercises/simple-cipher/canonical-data.json | 117 ++++++++++++++++++++ 1 file changed, 117 insertions(+) create mode 100644 exercises/simple-cipher/canonical-data.json diff --git a/exercises/simple-cipher/canonical-data.json b/exercises/simple-cipher/canonical-data.json new file mode 100644 index 0000000000..a04f766b90 --- /dev/null +++ b/exercises/simple-cipher/canonical-data.json @@ -0,0 +1,117 @@ +{ + "exercise": "simple-cipher", + "version": "1.0.0", + "cases": [ + { + "description": "Random key cipher", + "cases": [ + { + "description": "It has a key made of letters", + "property": "key", + "input": "any", + "matches_regex": "^[a-z]+$" + }, + { + "description": "It can encode", + "property": "encode", + "input_plaintext": "aaaaaaaaaa", + "output_key": "cipher.key" + }, + { + "description": "It can decode", + "property": "decode", + "input_key": "cipher.key", + "output_string": "aaaaaaaaaa" + }, + "description": "It is reversible", + "property": "encode -> decode", + "input_encode": "plaintext string", + "output_decode": "plaintext string" + ] + }, + { + "description": "Incorrect key cipher", + "cases": [ + { + "description": "It throws an error with an all caps key", + "property": "Cipher Key", + "input_all_caps_string": "ABCDEF", + "output_error": "Bad key" + }, + { + "description": "It throws an error with a numeric key", + "property": "Cipher Key", + "input_all_number_string": "'12345'", + "output_error": "Bad key" + }, + { + "description": "It throws an error with empty key", + "property": "Cipher Key", + "input_empty_string": "''", + "output_error": "Bad key" + } + ] + }, + { + "description": "Substitution cipher", + "cipher_key_string": "abcdefgihj", + "cases": [ + { + "description": "It keeps submitted key", + "property": "key", + "input_key": "cipher.key", + "output_key": "input_key" + }, + { + "description": "It can encode", + "property": "encode", + "input_string": "aaaaaaaaaa", + "output_key": "abcdefghij" + }, + { + "description": "It can decode", + "property": "decode", + "input_string": "abcdefghij", + "output_string": "aaaaaaaaaa" + }, + { + "description": "It is reversible", + "property": "encode -> decode", + "input_encode": "abcdefghij", + "output_decode": "abcdefghij" + }, + { + "description": "It can double shift encode", + "property": "key", + "cipher_key": "iamapandabear", + "case": { + "property": "encode", + "input_string": "iamapandabear", + "output_string": "qayaeaagacia" + } + }, + { + "description": "It can wrap on encode", + "property": "encode", + "input_string": "zzzzzzzzzz", + "output_string": "zabcdefghi" + }, + { + "description": "It can wrap on decode", + "property": "decode", + "input_string": "zabcdefghi", + "output_string": "zzzzzzzzzz" + }, + { + "description": "It can handle messages longer than the key", + "property": "cipher.key", + "cipher_key": "abc", + "case": { + "property": "encode", + "input_string": "iamapandabear", + "output_string": "iboaqcnecbfcr" + } + } + ] + } +} From 0918832af731b10595af801544055ccc580ca0b2 Mon Sep 17 00:00:00 2001 From: Aos Date: Fri, 20 Oct 2017 17:53:59 -0400 Subject: [PATCH 2/3] Added canonical data for simple cipher --- exercises/simple-cipher/canonical-data.json | 120 ++++++++++++++++++++ 1 file changed, 120 insertions(+) create mode 100644 exercises/simple-cipher/canonical-data.json diff --git a/exercises/simple-cipher/canonical-data.json b/exercises/simple-cipher/canonical-data.json new file mode 100644 index 0000000000..cc30c0ddad --- /dev/null +++ b/exercises/simple-cipher/canonical-data.json @@ -0,0 +1,120 @@ +{ + "exercise": "simple-cipher", + "version": "1.0.0", + "cases": [ + { + "description": "Random key cipher", + "cases": [ + { + "description": "It has a key made of letters", + "property": "key", + "input": "any", + "matches_regex": "^[a-z]+$" + }, + { + "description": "It can encode", + "property": "encode", + "input_plaintext": "aaaaaaaaaa", + "output_key": "cipher.key" + }, + { + "description": "It can decode", + "property": "decode", + "input_key": "cipher.key", + "output_string": "aaaaaaaaaa" + }, + { + "description": "It is reversible", + "property": "encode -> decode", + "input_encode": "plaintext string", + "output_decode": "plaintext string" + } + ] + }, + { + "description": "Incorrect key cipher", + "cases": [ + { + "description": "It throws an error with an all caps key", + "property": "Cipher Key", + "input_all_caps_string": "ABCDEF", + "output_error": "Bad key" + }, + { + "description": "It throws an error with a numeric key", + "property": "Cipher Key", + "input_all_number_string": "'12345'", + "output_error": "Bad key" + }, + { + "description": "It throws an error with empty key", + "property": "Cipher Key", + "input_empty_string": "''", + "output_error": "Bad key" + } + ] + }, + { + "description": "Substitution cipher", + "cipher_key_string": "abcdefgihj", + "cases": [ + { + "description": "It keeps submitted key", + "property": "key", + "input_key": "cipher.key", + "output_key": "input_key" + }, + { + "description": "It can encode", + "property": "encode", + "input_string": "aaaaaaaaaa", + "output_key": "abcdefghij" + }, + { + "description": "It can decode", + "property": "decode", + "input_string": "abcdefghij", + "output_string": "aaaaaaaaaa" + }, + { + "description": "It is reversible", + "property": "encode -> decode", + "input_encode": "abcdefghij", + "output_decode": "abcdefghij" + }, + { + "description": "It can double shift encode", + "property": "key", + "cipher_key": "iamapandabear", + "case": { + "property": "encode", + "input_string": "iamapandabear", + "output_string": "qayaeaagacia" + } + }, + { + "description": "It can wrap on encode", + "property": "encode", + "input_string": "zzzzzzzzzz", + "output_string": "zabcdefghi" + }, + { + "description": "It can wrap on decode", + "property": "decode", + "input_string": "zabcdefghi", + "output_string": "zzzzzzzzzz" + }, + { + "description": "It can handle messages longer than the key", + "property": "cipher.key", + "cipher_key": "abc", + "case": { + "property": "encode", + "input_string": "iamapandabear", + "output_string": "iboaqcnecbfcr" + } + } + ] + } + ] +} From 975979b338c5547994d50ad42718397a9b9c6a7e Mon Sep 17 00:00:00 2001 From: Aos Date: Tue, 14 Nov 2017 09:45:17 -0500 Subject: [PATCH 3/3] Fixing schema validation --- exercises/simple-cipher/canonical-data.json | 3 +++ 1 file changed, 3 insertions(+) diff --git a/exercises/simple-cipher/canonical-data.json b/exercises/simple-cipher/canonical-data.json index cc30c0ddad..20c74cbd5d 100644 --- a/exercises/simple-cipher/canonical-data.json +++ b/exercises/simple-cipher/canonical-data.json @@ -4,6 +4,7 @@ "cases": [ { "description": "Random key cipher", + "property": "random", "cases": [ { "description": "It has a key made of letters", @@ -33,6 +34,7 @@ }, { "description": "Incorrect key cipher", + "property": "incorrect", "cases": [ { "description": "It throws an error with an all caps key", @@ -56,6 +58,7 @@ }, { "description": "Substitution cipher", + "property": "substitution", "cipher_key_string": "abcdefgihj", "cases": [ {