Typex: add simple tests
This commit is contained in:
parent
1f9fd92b01
commit
765aded208
@ -86,6 +86,7 @@ import "./tests/ConvertCoordinateFormat";
|
||||
import "./tests/Enigma";
|
||||
import "./tests/Bombe";
|
||||
import "./tests/MultipleBombe";
|
||||
import "./tests/Typex";
|
||||
|
||||
// Cannot test operations that use the File type yet
|
||||
//import "./tests/SplitColourChannels";
|
||||
|
105
tests/operations/tests/Typex.mjs
Normal file
105
tests/operations/tests/Typex.mjs
Normal file
@ -0,0 +1,105 @@
|
||||
/**
|
||||
* Typex machine tests.
|
||||
* @author s2224834
|
||||
* @copyright Crown Copyright 2019
|
||||
* @license Apache-2.0
|
||||
*/
|
||||
import TestRegister from "../TestRegister";
|
||||
|
||||
TestRegister.addTests([
|
||||
{
|
||||
// Unlike Enigma we're not verifying against a real machine here, so this is just a test
|
||||
// to catch inadvertent breakage.
|
||||
name: "Typex: basic",
|
||||
input: "hello world, this is a test message.",
|
||||
expectedOutput: "VIXQQ VHLPN UCVLA QDZNZ EAYAT HWC",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Typex",
|
||||
"args": [
|
||||
"MCYLPQUVRXGSAOWNBJEZDTFKHI<BFHNQUW",
|
||||
false, "B", "C",
|
||||
"KHWENRCBISXJQGOFMAPVYZDLTU<BFHNQUW",
|
||||
false, "D", "E",
|
||||
"BYPDZMGIKQCUSATREHOJNLFWXV<BFHNQUW",
|
||||
false, "F", "G",
|
||||
"ZANJCGDLVHIXOBRPMSWQUKFYET<BFHNQUW",
|
||||
true, "H", "I",
|
||||
"QXBGUTOVFCZPJIHSWERYNDAMLK<BFHNQUW",
|
||||
true, "J", "K",
|
||||
"AN BC FG IE KD LU MH OR TS VZ WQ XJ YP",
|
||||
"EHZTLCVKFRPQSYANBUIWOJXGMD",
|
||||
"None", true
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
name: "Typex: keyboard",
|
||||
input: "hello world, this is a test message.",
|
||||
expectedOutput: "VIXQQ FDJXT WKLDQ DFQOD CNCSK NULBG JKQDD MVGQ",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Typex",
|
||||
"args": [
|
||||
"MCYLPQUVRXGSAOWNBJEZDTFKHI<BFHNQUW",
|
||||
false, "B", "C",
|
||||
"KHWENRCBISXJQGOFMAPVYZDLTU<BFHNQUW",
|
||||
false, "D", "E",
|
||||
"BYPDZMGIKQCUSATREHOJNLFWXV<BFHNQUW",
|
||||
false, "F", "G",
|
||||
"ZANJCGDLVHIXOBRPMSWQUKFYET<BFHNQUW",
|
||||
true, "H", "I",
|
||||
"QXBGUTOVFCZPJIHSWERYNDAMLK<BFHNQUW",
|
||||
true, "J", "K",
|
||||
"AN BC FG IE KD LU MH OR TS VZ WQ XJ YP",
|
||||
"EHZTLCVKFRPQSYANBUIWOJXGMD",
|
||||
"Encrypt", true
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
name: "Typex: self-decrypt",
|
||||
input: "hello world, this is a test message.",
|
||||
expectedOutput: "HELLO WORLD, THIS IS A TEST MESSAGE.",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Typex",
|
||||
"args": [
|
||||
"MCYLPQUVRXGSAOWNBJEZDTFKHI<BFHNQUW",
|
||||
false, "B", "C",
|
||||
"KHWENRCBISXJQGOFMAPVYZDLTU<BFHNQUW",
|
||||
false, "D", "E",
|
||||
"BYPDZMGIKQCUSATREHOJNLFWXV<BFHNQUW",
|
||||
false, "F", "G",
|
||||
"ZANJCGDLVHIXOBRPMSWQUKFYET<BFHNQUW",
|
||||
true, "H", "I",
|
||||
"QXBGUTOVFCZPJIHSWERYNDAMLK<BFHNQUW",
|
||||
true, "J", "K",
|
||||
"AN BC FG IE KD LU MH OR TS VZ WQ XJ YP",
|
||||
"EHZTLCVKFRPQSYANBUIWOJXGMD",
|
||||
"Encrypt", true
|
||||
]
|
||||
},
|
||||
{
|
||||
"op": "Typex",
|
||||
"args": [
|
||||
"MCYLPQUVRXGSAOWNBJEZDTFKHI<BFHNQUW",
|
||||
false, "B", "C",
|
||||
"KHWENRCBISXJQGOFMAPVYZDLTU<BFHNQUW",
|
||||
false, "D", "E",
|
||||
"BYPDZMGIKQCUSATREHOJNLFWXV<BFHNQUW",
|
||||
false, "F", "G",
|
||||
"ZANJCGDLVHIXOBRPMSWQUKFYET<BFHNQUW",
|
||||
true, "H", "I",
|
||||
"QXBGUTOVFCZPJIHSWERYNDAMLK<BFHNQUW",
|
||||
true, "J", "K",
|
||||
"AN BC FG IE KD LU MH OR TS VZ WQ XJ YP",
|
||||
"EHZTLCVKFRPQSYANBUIWOJXGMD",
|
||||
"Decrypt", true
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
]);
|
Loading…
x
Reference in New Issue
Block a user