From 6a370e3941e8fe15096bd22ce6ecb7b0a9853270 Mon Sep 17 00:00:00 2001 From: Flavio Diez Date: Mon, 27 Jan 2020 14:43:31 +0100 Subject: [PATCH] Tests for Rail Cipher Encode --- tests/operations/tests/Ciphers.mjs | 34 ++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/tests/operations/tests/Ciphers.mjs b/tests/operations/tests/Ciphers.mjs index 62cbaa54..0232a14d 100644 --- a/tests/operations/tests/Ciphers.mjs +++ b/tests/operations/tests/Ciphers.mjs @@ -3,6 +3,7 @@ * * @author Matt C [matt@artemisbot.uk] * @author n1474335 [n1474335@gmail.com] + * @author Flavio Diez [flaviofdiez+cyberchef@gmail.com] * * @copyright Crown Copyright 2018 * @license Apache-2.0 @@ -418,4 +419,37 @@ TestRegister.addTests([ } ], }, + { + name: "Rail Fence Cypher Decode: normal", + input: "Cytgah sTEAto rtn rsligcdsrporpyi H r fWiigo ovn oe", + expectedOutput: "Cryptography is THE Art of Writing or solving codes", + recipeConfig: [ + { + "op": "Rail Fence Cypher Decode", + "args": [2, 0] + } + ], + }, + { + name: "Rail Fence Cypher Decode: key has to be bigger than 2", + input: "Cytgah sTEAto rtn rsligcdsrporpyi H r fWiigo ovn oe", + expectedOutput: "Key has to be bigger than 2", + recipeConfig: [ + { + "op": "Rail Fence Cypher Decode", + "args": [1, 0] + } + ], + }, + { + name: "Rail Fence Cypher Decode: key has to be smaller than input's length", + input: "shortinput", + expectedOutput: "Key should be smaller than the cipher's length", + recipeConfig: [ + { + "op": "Rail Fence Cypher Decode", + "args": [22, 0] + } + ], + }, ]);