mirror of
https://github.com/gchq/CyberChef.git
synced 2025-04-25 09:16:17 -04:00
Merge 861f781485
into e48fc4c8d8
This commit is contained in:
commit
f01dbdfd3c
4 changed files with 122 additions and 1 deletions
|
@ -83,6 +83,7 @@ import "./tests/Hexdump.mjs";
|
|||
import "./tests/HKDF.mjs";
|
||||
import "./tests/Image.mjs";
|
||||
import "./tests/IndexOfCoincidence.mjs";
|
||||
import "./tests/InsertDelimiter.mjs";
|
||||
import "./tests/JA3Fingerprint.mjs";
|
||||
import "./tests/JA4.mjs";
|
||||
import "./tests/JA3SFingerprint.mjs";
|
||||
|
|
65
tests/operations/tests/InsertDelimiter.mjs
Normal file
65
tests/operations/tests/InsertDelimiter.mjs
Normal file
|
@ -0,0 +1,65 @@
|
|||
/**
|
||||
* @author 0xff1ce [github.com/0xff1ce]
|
||||
* @copyright Crown Copyright 2024
|
||||
* @license Apache-2.0
|
||||
*/
|
||||
|
||||
import TestRegister from "../../lib/TestRegister.mjs";
|
||||
|
||||
TestRegister.addTests([
|
||||
{
|
||||
name: "Insert space every 8 characters",
|
||||
input: "010010000110010101101100011011000110111100100000010101110110111101110010011011000110010000100001",
|
||||
expectedOutput: "01001000 01100101 01101100 01101100 01101111 00100000 01010111 01101111 01110010 01101100 01100100 00100001",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Insert Delimiter",
|
||||
"args": [8, " "]
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Insert newline every 4 characters",
|
||||
input: "ABCDEFGHIJKL",
|
||||
expectedOutput: "ABCD\nEFGH\nIJKL",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Insert Delimiter",
|
||||
"args": [4, "\n"]
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Insert hyphen every 3 characters",
|
||||
input: "1234567890",
|
||||
expectedOutput: "123-456-789-0",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Insert Delimiter",
|
||||
"args": [3, "-"]
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Use a float as delimiter",
|
||||
input: "1234567890",
|
||||
expectedOutput: "123-456-789-0",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Insert Delimiter",
|
||||
"args": [3.4, "-"]
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Handle empty input gracefully",
|
||||
input: "",
|
||||
expectedOutput: "",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Insert Delimiter",
|
||||
"args": [8, " "]
|
||||
},
|
||||
],
|
||||
}
|
||||
]);
|
Loading…
Add table
Add a link
Reference in a new issue