1
0
mirror of synced 2024-12-20 18:55:52 +01:00
CyberChef/tests/operations/tests/Base45.mjs

102 lines
2.1 KiB
JavaScript
Raw Normal View History

/**
* Base45 tests.
*
* @author Thomas Weißschuh [thomas@t-8ch.de]
*
* @copyright Crown Copyright 2021
* @license Apache-2.0
*/
import TestRegister from "../../lib/TestRegister.mjs";
TestRegister.addTests([
{
name: "To Base45: nothing",
input: "",
expectedOutput: "",
recipeConfig: [
{
op: "To Base45",
args: [],
},
],
},
{
name: "To Base45: Spec encoding example 1",
input: "AB",
expectedOutput: "BB8",
recipeConfig: [
{
op: "To Base45",
args: [],
},
],
},
{
name: "To Base45: Spec encoding example 2",
input: "Hello!!",
expectedOutput: "%69 VD92EX0",
recipeConfig: [
{
op: "To Base45",
args: [],
},
],
},
{
name: "To Base45: Spec encoding example 3",
input: "base-45",
expectedOutput: "UJCLQE7W581",
recipeConfig: [
{
op: "To Base45",
args: [],
},
],
},
{
name: "From Base45: nothing",
input: "",
expectedOutput: "",
recipeConfig: [
{
op: "From Base45",
args: [],
},
],
},
{
name: "From Base45: Spec decoding example 1",
input: "QED8WEX0",
expectedOutput: "ietf!",
recipeConfig: [
{
op: "From Base45",
args: [],
},
],
},
{
name: "From Base45: Invalid character",
input: "!",
expectedOutput: "Character not in alphabet: '!'",
recipeConfig: [
{
op: "From Base45",
args: [],
},
],
},
{
name: "From Base45: Invalid triplet value",
input: "ZZZ",
expectedOutput: "Triplet too large: 'ZZZ'",
recipeConfig: [
{
op: "From Base45",
args: [],
},
],
},
]);