Hill Cipher tests and info added

This commit is contained in:
n1073645 2020-02-14 10:46:29 +00:00
parent f46d9414cf
commit 34cd4af5f5
5 changed files with 69 additions and 6 deletions

View file

@ -96,6 +96,7 @@ import "./tests/DefangIP.mjs";
import "./tests/ParseUDP.mjs";
import "./tests/AvroToJSON.mjs";
import "./tests/Lorenz.mjs";
import "./tests/HillCipher.mjs";
// Cannot test operations that use the File type yet

View file

@ -0,0 +1,47 @@
/**
* HillCipher tests
*
* @author n1073645 [n1073645@gmail.com]
* @copyright Crown Copyright 2020
* @license Apache-2.0
*/
import TestRegister from "../../lib/TestRegister.mjs";
TestRegister.addTests([
{
name: "Hill Cipher Encode",
input: "Hello World",
expectedOutput: "tutrquwdnv",
recipeConfig: [
{ "op": "Hill Cipher Encode",
"args": ["Test"] }
]
},
{
name: "Hill Cipher Decode",
input: "tutrquwdnv",
expectedOutput: "helloworld",
recipeConfig: [
{ "op": "Hill Cipher Decode",
"args": ["Test"] }
]
},
{
name: "Hill Cipher Bad Matrix",
input: "Hello World",
expectedOutput: "Determinant has common factors with the modular base.",
recipeConfig: [
{ "op": "Hill Cipher Encode",
"args": ["th"] }
]
},
{
name: "Hill Cipher Empty Key",
input: "Hello World",
expectedOutput: "",
recipeConfig: [
{ "op": "Hill Cipher Encode",
"args": [""] }
]
}
]);