Add Baudot operations

This commit is contained in:
PiggyMoe 2020-05-23 01:00:25 +08:00
parent 4c3324aea1
commit 34160dbf0d
No known key found for this signature in database
GPG key ID: 4F2DDB9491768DD5
5 changed files with 261 additions and 1 deletions

View file

@ -23,6 +23,7 @@ import "./tests/BaconCipher.mjs";
import "./tests/Base58.mjs";
import "./tests/Base64.mjs";
import "./tests/Base62.mjs";
import "./tests/BaudotCode.mjs";
import "./tests/BitwiseOp.mjs";
import "./tests/ByteRepr.mjs";
import "./tests/CartesianProduct.mjs";

View file

@ -0,0 +1,56 @@
/**
* Baudot code tests.
*
* @author piggymoe [me@piggy.moe]
*
* @copyright Crown Copyright 2020
* @license Apache-2.0
*/
import TestRegister from "../../lib/TestRegister.mjs";
TestRegister.addTests([
{
name: "To Baudot Code (BE)",
input: "1+1 EQUALS 2",
expectedOutput: "11011 10111 10001 10111 00100 11111 00001 10111 00111 00011 10010 00101 00100 11011 10011",
recipeConfig: [
{
op: "To Baudot Code",
args: ["Big-endian"],
},
],
},
{
name: "To Baudot Code (LE)",
input: "1+1 EQUALS 2",
expectedOutput: "11011 11101 10001 11101 00100 11111 10000 11101 11100 11000 01001 10100 00100 11011 11001",
recipeConfig: [
{
op: "To Baudot Code",
args: ["Little-endian"],
},
],
},
{
name: "From Baudot Code (BE)",
input: "11011 10111 10001 10111 00100 11111 00001 10111 00111 00011 10010 00101 00100 11011 10011",
expectedOutput: "1+1 EQUALS 2",
recipeConfig: [
{
op: "From Baudot Code",
args: ["Big-endian"],
},
],
},
{
name: "From Baudot Code (LE)",
input: "11011 11101 10001 11101 00100 11111 10000 11101 11100 11000 01001 10100 00100 11011 11001",
expectedOutput: "1+1 EQUALS 2",
recipeConfig: [
{
op: "From Baudot Code",
args: ["Little-endian"],
},
],
},
]);