From 3f0af9cdea617c6a3113b7507e35c8affa6dfb53 Mon Sep 17 00:00:00 2001 From: Chris van Marle Date: Mon, 22 Oct 2018 17:51:26 +0800 Subject: [PATCH] Add tests for From Decimal --- test/index.mjs | 3 ++- test/tests/operations/FromDecimal.mjs | 33 +++++++++++++++++++++++++++ 2 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 test/tests/operations/FromDecimal.mjs diff --git a/test/index.mjs b/test/index.mjs index 9bb93a60..93dfecf6 100644 --- a/test/index.mjs +++ b/test/index.mjs @@ -41,7 +41,8 @@ import "./tests/operations/ConditionalJump"; import "./tests/operations/Crypt"; import "./tests/operations/DateTime"; import "./tests/operations/Fork"; -import "./tests/operations/FromGeohash.mjs"; +import "./tests/operations/FromDecimal"; +import "./tests/operations/FromGeohash"; import "./tests/operations/Hash"; import "./tests/operations/HaversineDistance"; import "./tests/operations/Hexdump"; diff --git a/test/tests/operations/FromDecimal.mjs b/test/tests/operations/FromDecimal.mjs new file mode 100644 index 00000000..95078cdb --- /dev/null +++ b/test/tests/operations/FromDecimal.mjs @@ -0,0 +1,33 @@ +/** + * From Decimal tests + * + * @author qistoph + * @copyright Crown Copyright 2018 + * @licence Apache-2.0 + */ +import TestRegister from "../../TestRegister"; + +TestRegister.addTests([ + { + name: "From Decimal", + input: "83 97 109 112 108 101 32 84 101 120 116", + expectedOutput: "Sample Text", + recipeConfig: [ + { + op: "From Decimal", + args: ["Space", false] + }, + ], + }, + { + name: "From Decimal with negatives", + input: "-130,-140,-152,-151,115,33,0,-1", + expectedOutput: "~this!\u0000\u00ff", + recipeConfig: [ + { + op: "From Decimal", + args: ["Comma", true] + }, + ], + }, +]);