Adds Base85 operation to resolve #286

This commit is contained in:
George J 2018-05-06 14:41:35 +01:00
parent 403296cc59
commit d6fb200fb2
6 changed files with 290 additions and 0 deletions

View file

@ -15,6 +15,7 @@ import "babel-polyfill";
import TestRegister from "./TestRegister.js";
import "./tests/operations/Base58.js";
import "./tests/operations/Base64.js";
import "./tests/operations/Base85.js";
import "./tests/operations/BCD.js";
import "./tests/operations/BitwiseOp.js";
import "./tests/operations/BSON.js";

View file

@ -0,0 +1,89 @@
/**
* Base85 tests.
*
* @author George J [george@penguingeorge.com]
*
* @copyright Crown Copyright 2018
* @license Apache-2.0
*/
import TestRegister from "../../TestRegister.js";
TestRegister.addTests([
{
name: "To Base85 (Standard): nothing",
input: "",
expectedOutput: "",
recipeConfig: [
{
op: "To Base85",
args: [null, false],
},
],
},
{
name: "To Base85 (Standard (Ascii85)): Hello, World!",
input: "Hello, World!",
expectedOutput: "87cURD_*#4DfTZ)+T",
recipeConfig: [
{
op: "To Base85",
args: [null, false],
},
],
},
{
name: "To Base85 (Standard (Ascii85)): UTF-8",
input: "ნუ პანიკას",
expectedOutput: "iIdZZK;0RJK:_%SOPth^iIdNVK:1\\NOPthc",
recipeConfig: [
{
op: "To Base85",
args: [null, false],
},
],
},
{
name: "To Base85 (Z85 (ZeroMQ)): Hello, World!",
input: "Hello, World!",
expectedOutput: "nm2QNz.92jz5PV8aP",
recipeConfig: [
{
op: "To Base85",
args: ["0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ.-:+=^!/*?&<>()[]{}@%$#", false],
},
],
},
{
name: "From Base85 (Standard): nothing",
input: "",
expectedOutput: "",
recipeConfig: [
{
op: "From Base85",
args: [null, false],
},
],
},
{
name: "From Base85 (Standard): Hello, World!",
input: "87cURD_*#4DfTZ)+T",
expectedOutput: "Hello, World!",
recipeConfig: [
{
op: "From Base85",
args: [null, false],
},
],
},
{
name: "From Base85 (Standard): UTF-8",
input: "iIdZZK;0RJK:_%SOPth^iIdNVK:1\\NOPthc",
expectedOutput: "ნუ პანიკას",
recipeConfig: [
{
op: "From Base85",
args: [null, false],
},
],
},
]);