Browse Source

Added test for 'Decode Protobuf' operation

n1474335 6 năm trước cách đây
mục cha
commit
f6977ea264
2 tập tin đã thay đổi với 37 bổ sung0 xóa
  1. 1 0
      tests/operations/index.mjs
  2. 36 0
      tests/operations/tests/Protobuf.mjs

+ 1 - 0
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";

+ 36 - 0
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": []
+            }
+        ]
+    },
+]);