From f6977ea26476492034299480935da2989d3fc11b Mon Sep 17 00:00:00 2001 From: n1474335 Date: Fri, 12 Apr 2019 16:13:10 +0100 Subject: [PATCH] Added test for 'Decode Protobuf' operation --- tests/operations/index.mjs | 1 + tests/operations/tests/Protobuf.mjs | 36 +++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+) create mode 100644 tests/operations/tests/Protobuf.mjs diff --git a/tests/operations/index.mjs b/tests/operations/index.mjs index e9fc62713..41d78c353 100644 --- a/tests/operations/index.mjs +++ b/tests/operations/index.mjs @@ -89,6 +89,7 @@ import "./tests/MultipleBombe"; import "./tests/Typex"; import "./tests/BLAKE2b"; import "./tests/BLAKE2s"; +import "./tests/Protobuf"; // Cannot test operations that use the File type yet //import "./tests/SplitColourChannels"; diff --git a/tests/operations/tests/Protobuf.mjs b/tests/operations/tests/Protobuf.mjs new file mode 100644 index 000000000..957e4d54a --- /dev/null +++ b/tests/operations/tests/Protobuf.mjs @@ -0,0 +1,36 @@ +/** + * Protobuf tests. + * + * @author n1474335 [n1474335@gmail.com] + * @copyright Crown Copyright 2019 + * @license Apache-2.0 + */ + +import TestRegister from "../TestRegister"; + +TestRegister.addTests([ + { + name: "Protobuf Decode", + input: "0d1c0000001203596f751a024d65202b2a0a0a066162633132331200", + expectedOutput: JSON.stringify({ + "1": 469762048, + "2": "You", + "3": "Me", + "4": 43, + "5": { + "1": "abc123", + "2": {} + } + }, null, 4), + recipeConfig: [ + { + "op": "From Hex", + "args": ["Auto"] + }, + { + "op": "Protobuf Decode", + "args": [] + } + ] + }, +]);