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",
|
|
|
|
"args": ["UTF-8"]
|
2017-05-08 00:07:56 +02:00
|
|
|
},
|
|
|
|
{
|
2017-05-17 17:17:11 +02:00
|
|
|
"op": "Decode text",
|
|
|
|
"args": ["UTF-8"]
|
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",
|
|
|
|
"args": ["UTF-8"]
|
2017-05-08 00:07:56 +02:00
|
|
|
},
|
|
|
|
{
|
2017-05-17 17:17:11 +02:00
|
|
|
"op": "Decode text",
|
|
|
|
"args": ["UTF-8"]
|
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-08 00:07:56 +02:00
|
|
|
"args": ["IBM EBCDIC International"]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"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",
|
|
|
|
"args": ["IBM EBCDIC International"]
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
2017-05-08 00:07:56 +02:00
|
|
|
]);
|