2017-05-08 00:07:56 +02:00
|
|
|
/**
|
|
|
|
* CharEnc tests.
|
|
|
|
*
|
|
|
|
* @author tlwr [toby@toby.codes]
|
|
|
|
* @copyright Crown Copyright 2017
|
|
|
|
* @license Apache-2.0
|
|
|
|
*/
|
|
|
|
import TestRegister from "../../TestRegister.js";
|
|
|
|
|
|
|
|
TestRegister.addTests([
|
|
|
|
{
|
2017-05-17 17:17:11 +02:00
|
|
|
name: "Encode text, Decode text: nothing",
|
2017-05-08 00:07:56 +02:00
|
|
|
input: "",
|
|
|
|
expectedOutput: "",
|
|
|
|
recipeConfig: [
|
|
|
|
{
|
2017-05-17 17:17:11 +02:00
|
|
|
"op": "Encode text",
|
2017-05-18 00:22:04 +02:00
|
|
|
"args": ["UTF-8 (65001)"]
|
2017-05-08 00:07:56 +02:00
|
|
|
},
|
|
|
|
{
|
2017-05-17 17:17:11 +02:00
|
|
|
"op": "Decode text",
|
2017-05-18 00:22:04 +02:00
|
|
|
"args": ["UTF-8 (65001)"]
|
2017-05-08 00:07:56 +02:00
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
{
|
2017-05-17 17:17:11 +02:00
|
|
|
name: "Encode text, Decode text: hello",
|
|
|
|
input: "hello",
|
2017-05-08 00:07:56 +02:00
|
|
|
expectedOutput: "hello",
|
|
|
|
recipeConfig: [
|
|
|
|
{
|
2017-05-17 17:17:11 +02:00
|
|
|
"op": "Encode text",
|
2017-05-18 00:22:04 +02:00
|
|
|
"args": ["UTF-8 (65001)"]
|
2017-05-08 00:07:56 +02:00
|
|
|
},
|
|
|
|
{
|
2017-05-17 17:17:11 +02:00
|
|
|
"op": "Decode text",
|
2017-05-18 00:22:04 +02:00
|
|
|
"args": ["UTF-8 (65001)"]
|
2017-05-08 00:07:56 +02:00
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
{
|
2017-05-17 17:17:11 +02:00
|
|
|
name: "Encode text (EBCDIC): hello",
|
2017-05-08 00:07:56 +02:00
|
|
|
input: "hello",
|
|
|
|
expectedOutput: "88 85 93 93 96",
|
|
|
|
recipeConfig: [
|
|
|
|
{
|
2017-05-17 17:17:11 +02:00
|
|
|
"op": "Encode text",
|
2017-05-18 00:22:04 +02:00
|
|
|
"args": ["IBM EBCDIC International (500)"]
|
2017-05-08 00:07:56 +02:00
|
|
|
},
|
|
|
|
{
|
|
|
|
"op": "To Hex",
|
|
|
|
"args": ["Space"]
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
2017-05-17 17:17:11 +02:00
|
|
|
{
|
|
|
|
name: "Decode text (EBCDIC): 88 85 93 93 96",
|
|
|
|
input: "88 85 93 93 96",
|
|
|
|
expectedOutput: "hello",
|
|
|
|
recipeConfig: [
|
|
|
|
{
|
|
|
|
"op": "From Hex",
|
|
|
|
"args": ["Space"]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"op": "Decode text",
|
2017-05-18 00:22:04 +02:00
|
|
|
"args": ["IBM EBCDIC International (500)"]
|
2017-05-17 17:17:11 +02:00
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
2017-05-19 22:11:08 +02:00
|
|
|
{
|
|
|
|
name: "Generate Base64 Windows Powershell",
|
|
|
|
input: "ZABpAHIAIAAiAGMAOgBcAHAAcgBvAGcAcgBhAG0AIABmAGkAbABlAHMAIgAgAA==",
|
|
|
|
expectedOutput: "dir \"c:\\program files\" ",
|
|
|
|
recipeConfig: [
|
|
|
|
{
|
|
|
|
"op": "From Base64",
|
|
|
|
"args": ["A-Za-z0-9+/=", true]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"op": "Decode text",
|
|
|
|
"args": ["UTF16LE (1200)"]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"op": "Encode text",
|
|
|
|
"args": ["UTF-8 (65001)"]
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
2017-05-08 00:07:56 +02:00
|
|
|
]);
|