-
-
Notifications
You must be signed in to change notification settings - Fork 546
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
simple-cipher: Add canonical data #966
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,123 @@ | ||
{ | ||
"exercise": "simple-cipher", | ||
"version": "1.0.0", | ||
"cases": [ | ||
{ | ||
"description": "Random key cipher", | ||
"property": "random", | ||
"cases": [ | ||
{ | ||
"description": "It has a key made of letters", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe shorten to "Key has only lower-case letters"? |
||
"property": "key", | ||
"input": "any", | ||
"matches_regex": "^[a-z]+$" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We are in the process of enforcing |
||
}, | ||
{ | ||
"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" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should be renamed to |
||
}, | ||
{ | ||
"description": "It is reversible", | ||
"property": "encode -> decode", | ||
"input_encode": "plaintext string", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe rename to |
||
"output_decode": "plaintext string" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should be renamed to |
||
} | ||
] | ||
}, | ||
{ | ||
"description": "Incorrect key cipher", | ||
"property": "incorrect", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure, but I don't think this line actually does anything. The |
||
"cases": [ | ||
{ | ||
"description": "It throws an error with an all caps key", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe this test should be about testing a string with a single uppercase character, as that is the minimal counter-example. |
||
"property": "Cipher Key", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think the property should be |
||
"input_all_caps_string": "ABCDEF", | ||
"output_error": "Bad key" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This property should be renamed to |
||
}, | ||
{ | ||
"description": "It throws an error with a numeric key", | ||
"property": "Cipher Key", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think the property should be |
||
"input_all_number_string": "'12345'", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Rename to |
||
"output_error": "Bad key" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This property should be renamed to |
||
}, | ||
{ | ||
"description": "It throws an error with empty key", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe rephrase to something like: "An empty key is invalid" |
||
"property": "Cipher Key", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe rename the property to |
||
"input_empty_string": "''", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would rename to |
||
"output_error": "Bad key" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This property should be renamed to |
||
} | ||
] | ||
}, | ||
{ | ||
"description": "Substitution cipher", | ||
"property": "substitution", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure, but I don't think this line actually does anything. The There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should this be There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Possibly it should be |
||
"cipher_key_string": "abcdefgihj", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this the key that is used in the nested cases? If so, I would suggest removing it here and copying it to each single test case. I would also rename it to |
||
"cases": [ | ||
{ | ||
"description": "It keeps submitted key", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What does this test do? |
||
"property": "key", | ||
"input_key": "cipher.key", | ||
"output_key": "input_key" | ||
}, | ||
{ | ||
"description": "It can encode", | ||
"property": "encode", | ||
"input_string": "aaaaaaaaaa", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Rename to |
||
"output_key": "abcdefghij" | ||
}, | ||
{ | ||
"description": "It can decode", | ||
"property": "decode", | ||
"input_string": "abcdefghij", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Rename to |
||
"output_string": "aaaaaaaaaa" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Rename to |
||
}, | ||
{ | ||
"description": "It is reversible", | ||
"property": "encode -> decode", | ||
"input_encode": "abcdefghij", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Rename to |
||
"output_decode": "abcdefghij" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Rename to |
||
}, | ||
{ | ||
"description": "It can double shift encode", | ||
"property": "key", | ||
"cipher_key": "iamapandabear", | ||
"case": { | ||
"property": "encode", | ||
"input_string": "iamapandabear", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Rename to |
||
"output_string": "qayaeaagacia" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Rename to |
||
} | ||
}, | ||
{ | ||
"description": "It can wrap on encode", | ||
"property": "encode", | ||
"input_string": "zzzzzzzzzz", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Rename to |
||
"output_string": "zabcdefghi" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Rename to |
||
}, | ||
{ | ||
"description": "It can wrap on decode", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe shorten to |
||
"property": "decode", | ||
"input_string": "zabcdefghi", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Renamed to |
||
"output_string": "zzzzzzzzzz" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Rename to |
||
}, | ||
{ | ||
"description": "It can handle messages longer than the key", | ||
"property": "cipher.key", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would use the |
||
"cipher_key": "abc", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe just use |
||
"case": { | ||
"property": "encode", | ||
"input_string": "iamapandabear", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Rename to |
||
"output_string": "iboaqcnecbfcr" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Rename to |
||
} | ||
} | ||
] | ||
} | ||
] | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure, but I don't think this line actually does anything. The
property
key is normally used for specifying which method/property to test. As this is just a container for individual cases, I think it can be removed.