Selaa lähdekoodia

Merge pull request #1714 from sw5678/master

Adding and removing tests
a3957273 1 vuosi sitten
vanhempi
commit
fc7c6312e6

+ 60 - 61
tests/operations/index.mjs

@@ -17,131 +17,130 @@ import {
 } from "../lib/utils.mjs";
 } from "../lib/utils.mjs";
 
 
 import TestRegister from "../lib/TestRegister.mjs";
 import TestRegister from "../lib/TestRegister.mjs";
-import "./tests/BCD.mjs";
-import "./tests/BSON.mjs";
+import "./tests/AESKeyWrap.mjs";
+import "./tests/AvroToJSON.mjs";
 import "./tests/BaconCipher.mjs";
 import "./tests/BaconCipher.mjs";
 import "./tests/Base45.mjs";
 import "./tests/Base45.mjs";
 import "./tests/Base58.mjs";
 import "./tests/Base58.mjs";
-import "./tests/Base64.mjs";
 import "./tests/Base62.mjs";
 import "./tests/Base62.mjs";
+import "./tests/Base64.mjs";
 import "./tests/Base85.mjs";
 import "./tests/Base85.mjs";
 import "./tests/Base92.mjs";
 import "./tests/Base92.mjs";
+import "./tests/BCD.mjs";
 import "./tests/BitwiseOp.mjs";
 import "./tests/BitwiseOp.mjs";
+import "./tests/BLAKE2b.mjs";
+import "./tests/BLAKE2s.mjs";
+import "./tests/Bombe.mjs";
+import "./tests/BSON.mjs";
 import "./tests/ByteRepr.mjs";
 import "./tests/ByteRepr.mjs";
+import "./tests/CaesarBoxCipher.mjs";
 import "./tests/CartesianProduct.mjs";
 import "./tests/CartesianProduct.mjs";
-import "./tests/CetaceanCipherEncode.mjs";
+import "./tests/CBORDecode.mjs";
+import "./tests/CBOREncode.mjs";
 import "./tests/CetaceanCipherDecode.mjs";
 import "./tests/CetaceanCipherDecode.mjs";
+import "./tests/CetaceanCipherEncode.mjs";
 import "./tests/ChaCha.mjs";
 import "./tests/ChaCha.mjs";
-import "./tests/CharEnc.mjs";
 import "./tests/ChangeIPFormat.mjs";
 import "./tests/ChangeIPFormat.mjs";
+import "./tests/CharEnc.mjs";
 import "./tests/Charts.mjs";
 import "./tests/Charts.mjs";
 import "./tests/Checksum.mjs";
 import "./tests/Checksum.mjs";
 import "./tests/Ciphers.mjs";
 import "./tests/Ciphers.mjs";
+import "./tests/CipherSaber2.mjs";
+import "./tests/CMAC.mjs";
 import "./tests/Code.mjs";
 import "./tests/Code.mjs";
+import "./tests/Colossus.mjs";
 import "./tests/Comment.mjs";
 import "./tests/Comment.mjs";
 import "./tests/Compress.mjs";
 import "./tests/Compress.mjs";
 import "./tests/ConditionalJump.mjs";
 import "./tests/ConditionalJump.mjs";
+import "./tests/ConvertCoordinateFormat.mjs";
+import "./tests/ConvertToNATOAlphabet.mjs";
 import "./tests/Crypt.mjs";
 import "./tests/Crypt.mjs";
 import "./tests/CSV.mjs";
 import "./tests/CSV.mjs";
 import "./tests/DateTime.mjs";
 import "./tests/DateTime.mjs";
+import "./tests/DefangIP.mjs";
+import "./tests/ELFInfo.mjs";
+import "./tests/Enigma.mjs";
 import "./tests/ExtractEmailAddresses.mjs";
 import "./tests/ExtractEmailAddresses.mjs";
+import "./tests/FileTree.mjs";
+import "./tests/FletcherChecksum.mjs";
 import "./tests/Fork.mjs";
 import "./tests/Fork.mjs";
 import "./tests/FromDecimal.mjs";
 import "./tests/FromDecimal.mjs";
 import "./tests/GenerateAllHashes.mjs";
 import "./tests/GenerateAllHashes.mjs";
-import "./tests/Gzip.mjs";
+import "./tests/GenerateDeBruijnSequence.mjs";
+import "./tests/GetAllCasings.mjs";
+import "./tests/GOST.mjs";
 import "./tests/Gunzip.mjs";
 import "./tests/Gunzip.mjs";
+import "./tests/Gzip.mjs";
 import "./tests/Hash.mjs";
 import "./tests/Hash.mjs";
+import "./tests/HASSH.mjs";
 import "./tests/HaversineDistance.mjs";
 import "./tests/HaversineDistance.mjs";
 import "./tests/Hex.mjs";
 import "./tests/Hex.mjs";
 import "./tests/Hexdump.mjs";
 import "./tests/Hexdump.mjs";
+import "./tests/HKDF.mjs";
 import "./tests/Image.mjs";
 import "./tests/Image.mjs";
 import "./tests/IndexOfCoincidence.mjs";
 import "./tests/IndexOfCoincidence.mjs";
-import "./tests/Jump.mjs";
+import "./tests/JA3Fingerprint.mjs";
+import "./tests/JA3SFingerprint.mjs";
 import "./tests/JSONBeautify.mjs";
 import "./tests/JSONBeautify.mjs";
 import "./tests/JSONMinify.mjs";
 import "./tests/JSONMinify.mjs";
 import "./tests/JSONtoCSV.mjs";
 import "./tests/JSONtoCSV.mjs";
+import "./tests/Jump.mjs";
 import "./tests/JWTDecode.mjs";
 import "./tests/JWTDecode.mjs";
 import "./tests/JWTSign.mjs";
 import "./tests/JWTSign.mjs";
 import "./tests/JWTVerify.mjs";
 import "./tests/JWTVerify.mjs";
+import "./tests/LevenshteinDistance.mjs";
+import "./tests/Lorenz.mjs";
+import "./tests/LS47.mjs";
+import "./tests/LuhnChecksum.mjs";
 import "./tests/LZNT1Decompress.mjs";
 import "./tests/LZNT1Decompress.mjs";
-import "./tests/MS.mjs";
+import "./tests/LZString.mjs";
 import "./tests/Magic.mjs";
 import "./tests/Magic.mjs";
+import "./tests/Media.mjs";
 import "./tests/MorseCode.mjs";
 import "./tests/MorseCode.mjs";
+import "./tests/MS.mjs";
+import "./tests/MultipleBombe.mjs";
 import "./tests/MurmurHash3.mjs";
 import "./tests/MurmurHash3.mjs";
 import "./tests/NetBIOS.mjs";
 import "./tests/NetBIOS.mjs";
 import "./tests/NormaliseUnicode.mjs";
 import "./tests/NormaliseUnicode.mjs";
+import "./tests/NTLM.mjs";
 import "./tests/OTP.mjs";
 import "./tests/OTP.mjs";
-import "./tests/PGP.mjs";
-import "./tests/PHP.mjs";
 import "./tests/ParseIPRange.mjs";
 import "./tests/ParseIPRange.mjs";
+import "./tests/ParseObjectIDTimestamp.mjs";
 import "./tests/ParseQRCode.mjs";
 import "./tests/ParseQRCode.mjs";
+import "./tests/ParseSSHHostKey.mjs";
+import "./tests/ParseTCP.mjs";
+import "./tests/ParseTLV.mjs";
+import "./tests/ParseUDP.mjs";
 import "./tests/PEMtoHex.mjs";
 import "./tests/PEMtoHex.mjs";
+import "./tests/PGP.mjs";
+import "./tests/PHP.mjs";
 import "./tests/PowerSet.mjs";
 import "./tests/PowerSet.mjs";
+import "./tests/Protobuf.mjs";
+import "./tests/Rabbit.mjs";
 import "./tests/Regex.mjs";
 import "./tests/Regex.mjs";
 import "./tests/Register.mjs";
 import "./tests/Register.mjs";
+import "./tests/RisonEncodeDecode.mjs";
 import "./tests/Rotate.mjs";
 import "./tests/Rotate.mjs";
+import "./tests/RSA.mjs";
 import "./tests/SeqUtils.mjs";
 import "./tests/SeqUtils.mjs";
 import "./tests/SetDifference.mjs";
 import "./tests/SetDifference.mjs";
 import "./tests/SetIntersection.mjs";
 import "./tests/SetIntersection.mjs";
 import "./tests/SetUnion.mjs";
 import "./tests/SetUnion.mjs";
+import "./tests/Shuffle.mjs";
+import "./tests/SIGABA.mjs";
 import "./tests/SM4.mjs";
 import "./tests/SM4.mjs";
+// import "./tests/SplitColourChannels.mjs"; // Cannot test operations that use the File type yet
 import "./tests/StrUtils.mjs";
 import "./tests/StrUtils.mjs";
+import "./tests/Subsection.mjs";
+import "./tests/SwapCase.mjs";
 import "./tests/SymmetricDifference.mjs";
 import "./tests/SymmetricDifference.mjs";
 import "./tests/TextEncodingBruteForce.mjs";
 import "./tests/TextEncodingBruteForce.mjs";
-import "./tests/TranslateDateTimeFormat.mjs";
-import "./tests/Magic.mjs";
-import "./tests/ParseTLV.mjs";
-import "./tests/Media.mjs";
 import "./tests/ToFromInsensitiveRegex.mjs";
 import "./tests/ToFromInsensitiveRegex.mjs";
-import "./tests/YARA.mjs";
-import "./tests/ConvertCoordinateFormat.mjs";
-import "./tests/Enigma.mjs";
-import "./tests/Bombe.mjs";
-import "./tests/MultipleBombe.mjs";
+import "./tests/TranslateDateTimeFormat.mjs";
 import "./tests/Typex.mjs";
 import "./tests/Typex.mjs";
-import "./tests/BLAKE2b.mjs";
-import "./tests/BLAKE2s.mjs";
-import "./tests/Protobuf.mjs";
-import "./tests/ParseSSHHostKey.mjs";
-import "./tests/DefangIP.mjs";
-import "./tests/ParseUDP.mjs";
-import "./tests/ParseTCP.mjs";
-import "./tests/AvroToJSON.mjs";
-import "./tests/Lorenz.mjs";
-import "./tests/LuhnChecksum.mjs";
-import "./tests/CipherSaber2.mjs";
-import "./tests/Colossus.mjs";
-import "./tests/ParseObjectIDTimestamp.mjs";
-import "./tests/Unicode.mjs";
-import "./tests/RSA.mjs";
-import "./tests/CBOREncode.mjs";
-import "./tests/CBORDecode.mjs";
-import "./tests/RisonEncodeDecode.mjs";
-import "./tests/JA3Fingerprint.mjs";
-import "./tests/JA3SFingerprint.mjs";
-import "./tests/HASSH.mjs";
-import "./tests/GetAllCasings.mjs";
-import "./tests/SIGABA.mjs";
-import "./tests/ELFInfo.mjs";
-import "./tests/Subsection.mjs";
-import "./tests/CaesarBoxCipher.mjs";
 import "./tests/UnescapeString.mjs";
 import "./tests/UnescapeString.mjs";
-import "./tests/LS47.mjs";
-import "./tests/LZString.mjs";
-import "./tests/NTLM.mjs";
-import "./tests/Shuffle.mjs";
-import "./tests/FletcherChecksum.mjs";
-import "./tests/CMAC.mjs";
-import "./tests/AESKeyWrap.mjs";
-import "./tests/Rabbit.mjs";
-import "./tests/LevenshteinDistance.mjs";
-import "./tests/SwapCase.mjs";
-import "./tests/HKDF.mjs";
-import "./tests/GenerateDeBruijnSequence.mjs";
-import "./tests/GOST.mjs";
-
-// Cannot test operations that use the File type yet
-// import "./tests/SplitColourChannels.mjs";
+import "./tests/Unicode.mjs";
+import "./tests/YARA.mjs";
 
 
 const testStatus = {
 const testStatus = {
     allTestsPassing: true,
     allTestsPassing: true,

+ 4 - 3
tests/operations/tests/FileTree.mjs

@@ -1,4 +1,6 @@
 /**
 /**
+ * File tree tests.
+ *
  * @author sw5678
  * @author sw5678
  * @copyright Crown Copyright 2023
  * @copyright Crown Copyright 2023
  * @license Apache-2.0
  * @license Apache-2.0
@@ -7,14 +9,13 @@ import TestRegister from "../../lib/TestRegister.mjs";
 
 
 TestRegister.addTests([
 TestRegister.addTests([
     {
     {
-        "name": "Swap Case: basic example",
+        "name": "File Tree: basic example",
         "input": "/test_dir1/test_file1.txt\n/test_dir1/test_file2.txt\n/test_dir2/test_file1.txt",
         "input": "/test_dir1/test_file1.txt\n/test_dir1/test_file2.txt\n/test_dir2/test_file1.txt",
         "expectedOutput": "test_dir1\n|---test_file1.txt\n|---test_file2.txt\ntest_dir2\n|---test_file1.txt",
         "expectedOutput": "test_dir1\n|---test_file1.txt\n|---test_file2.txt\ntest_dir2\n|---test_file1.txt",
         "recipeConfig": [
         "recipeConfig": [
             {
             {
                 "op": "File Tree",
                 "op": "File Tree",
-                "args": [
-                ],
+                "args": ["/", "Line feed"],
             },
             },
         ],
         ],
     }
     }

+ 0 - 55
tests/operations/tests/FromGeohash.mjs

@@ -1,55 +0,0 @@
-/**
- * To Geohash tests
- *
- * @author gchq77703
- * @copyright Crown Copyright 2018
- * @license Apache-2.0
- */
-import TestRegister from "../../lib/TestRegister.mjs";
-
-TestRegister.addTests([
-    {
-        name: "From Geohash",
-        input: "ww8p1r4t8",
-        expectedOutput: "37.83238649368286,112.55838632583618",
-        recipeConfig: [
-            {
-                op: "From Geohash",
-                args: [],
-            },
-        ],
-    },
-    {
-        name: "From Geohash",
-        input: "ww8p1r",
-        expectedOutput: "37.83416748046875,112.5604248046875",
-        recipeConfig: [
-            {
-                op: "From Geohash",
-                args: [],
-            },
-        ],
-    },
-    {
-        name: "From Geohash",
-        input: "ww8",
-        expectedOutput: "37.265625,113.203125",
-        recipeConfig: [
-            {
-                op: "From Geohash",
-                args: [],
-            },
-        ],
-    },
-    {
-        name: "From Geohash",
-        input: "w",
-        expectedOutput: "22.5,112.5",
-        recipeConfig: [
-            {
-                op: "From Geohash",
-                args: [],
-            },
-        ],
-    },
-]);

+ 0 - 55
tests/operations/tests/ToGeohash.mjs

@@ -1,55 +0,0 @@
-/**
- * To Geohash tests
- *
- * @author gchq77703
- * @copyright Crown Copyright 2018
- * @license Apache-2.0
- */
-import TestRegister from "../../lib/TestRegister.mjs";
-
-TestRegister.addTests([
-    {
-        name: "To Geohash",
-        input: "37.8324,112.5584",
-        expectedOutput: "ww8p1r4t8",
-        recipeConfig: [
-            {
-                op: "To Geohash",
-                args: [9],
-            },
-        ],
-    },
-    {
-        name: "To Geohash",
-        input: "37.9324,-112.2584",
-        expectedOutput: "9w8pv3ruj",
-        recipeConfig: [
-            {
-                op: "To Geohash",
-                args: [9],
-            },
-        ],
-    },
-    {
-        name: "To Geohash",
-        input: "37.8324,112.5584",
-        expectedOutput: "ww8",
-        recipeConfig: [
-            {
-                op: "To Geohash",
-                args: [3],
-            },
-        ],
-    },
-    {
-        name: "To Geohash",
-        input: "37.9324,-112.2584",
-        expectedOutput: "9w8pv3rujxy5b99",
-        recipeConfig: [
-            {
-                op: "To Geohash",
-                args: [15],
-            },
-        ],
-    },
-]);