mirror of
https://github.com/gchq/CyberChef.git
synced 2025-04-22 07:46:16 -04:00
Converted substitute operation, added tests & moved to OperationError
This commit is contained in:
parent
350d10d98b
commit
2d6a56343b
8 changed files with 125 additions and 12 deletions
|
@ -3,7 +3,7 @@
|
|||
*
|
||||
* @author Matt C [matt@artemisbot.uk]
|
||||
* @author n1474335 [n1474335@gmail.com]
|
||||
*
|
||||
*
|
||||
* @copyright Crown Copyright 2018
|
||||
* @license Apache-2.0
|
||||
*/
|
||||
|
@ -308,4 +308,48 @@ TestRegister.addTests([
|
|||
}
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Substitute: no pt/ct",
|
||||
input: "flee at once. we are discovered!",
|
||||
expectedOutput: "flee at once. we are discovered!",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Substitute",
|
||||
"args": ["", ""]
|
||||
}
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Substitute: no input",
|
||||
input: "",
|
||||
expectedOutput: "",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Substitute",
|
||||
"args": ["abcdefghijklmnopqrstuvwxyz", "zebrascdfghijklmnopqtuvwxy"]
|
||||
}
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Substitute: uneven pt/ct",
|
||||
input: "flee at once. we are discovered!",
|
||||
expectedOutput: "Warning: Plaintext and Ciphertext lengths differ\n\nsiaa zq lkba. va zoa rfpbluaoar!",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Substitute",
|
||||
"args": ["abcdefghijklmnopqrstuvwxyz", "zebrascdfghijklmnopqtuvwx"]
|
||||
}
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Substitute: normal",
|
||||
input: "flee at once. we are discovered!",
|
||||
expectedOutput: "siaa zq lkba. va zoa rfpbluaoar!",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Substitute",
|
||||
"args": ["abcdefghijklmnopqrstuvwxyz", "zebrascdfghijklmnopqtuvwxy"]
|
||||
}
|
||||
],
|
||||
},
|
||||
]);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue