2017-02-23 19:59:58 +01:00
|
|
|
/**
|
|
|
|
* Base58 tests.
|
|
|
|
*
|
2017-02-28 18:08:36 +01:00
|
|
|
* @author tlwr [toby@toby.codes]
|
2017-02-23 19:59:58 +01:00
|
|
|
*
|
|
|
|
* @copyright Crown Copyright 2017
|
|
|
|
* @license Apache-2.0
|
|
|
|
*/
|
2018-05-17 17:34:00 +02:00
|
|
|
import TestRegister from "../../TestRegister";
|
2017-03-21 23:41:44 +01:00
|
|
|
|
2017-02-23 19:59:58 +01:00
|
|
|
TestRegister.addTests([
|
|
|
|
{
|
|
|
|
name: "To Base58 (Bitcoin): nothing",
|
|
|
|
input: "",
|
|
|
|
expectedOutput: "",
|
|
|
|
recipeConfig: [
|
|
|
|
{
|
|
|
|
op: "To Base58",
|
|
|
|
args: ["123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"],
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: "To Base58 (Ripple): nothing",
|
|
|
|
input: "",
|
|
|
|
expectedOutput: "",
|
|
|
|
recipeConfig: [
|
|
|
|
{
|
|
|
|
op: "To Base58",
|
|
|
|
args: ["rpshnaf39wBUDNEGHJKLM4PQRST7VWXYZ2bcdeCg65jkm8oFqi1tuvAxyz"],
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: "To Base58 (Bitcoin): 'hello world'",
|
|
|
|
input: "hello world",
|
|
|
|
expectedOutput: "StV1DL6CwTryKyV",
|
|
|
|
recipeConfig: [
|
|
|
|
{
|
|
|
|
op: "To Base58",
|
|
|
|
args: ["123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"],
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: "To Base58 (Ripple): 'hello world'",
|
|
|
|
input: "hello world",
|
|
|
|
expectedOutput: "StVrDLaUATiyKyV",
|
|
|
|
recipeConfig: [
|
|
|
|
{
|
|
|
|
op: "To Base58",
|
|
|
|
args: ["rpshnaf39wBUDNEGHJKLM4PQRST7VWXYZ2bcdeCg65jkm8oFqi1tuvAxyz"],
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
2018-10-22 03:10:49 +02:00
|
|
|
{
|
|
|
|
name: "To Base58 with null prefix and suffix",
|
|
|
|
input: "\0\0\0Hello\0\0\0",
|
|
|
|
expectedOutput: "111D7LMXYjHjTu",
|
|
|
|
recipeConfig: [
|
|
|
|
{
|
|
|
|
op: "To Base58",
|
|
|
|
args: ["123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"],
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: "From Base58 with null prefix and suffix",
|
|
|
|
input: "111D7LMXYjHjTu",
|
|
|
|
expectedOutput: "\0\0\0Hello\0\0\0",
|
|
|
|
recipeConfig: [
|
|
|
|
{
|
|
|
|
op: "From Base58",
|
|
|
|
args: ["123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"],
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
2017-02-23 19:59:58 +01:00
|
|
|
{
|
|
|
|
name: "From Base58 (Bitcoin): 'StV1DL6CwTryKyV'",
|
|
|
|
input: "StV1DL6CwTryKyV",
|
|
|
|
expectedOutput: "hello world",
|
|
|
|
recipeConfig: [
|
|
|
|
{
|
|
|
|
op: "From Base58",
|
|
|
|
args: ["123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"],
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: "From Base58 (Ripple): 'StVrDLaUATiyKyV'",
|
|
|
|
input: "StVrDLaUATiyKyV",
|
|
|
|
expectedOutput: "hello world",
|
|
|
|
recipeConfig: [
|
|
|
|
{
|
|
|
|
op: "From Base58",
|
|
|
|
args: ["rpshnaf39wBUDNEGHJKLM4PQRST7VWXYZ2bcdeCg65jkm8oFqi1tuvAxyz"],
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
]);
|