mirror of
https://github.com/gchq/CyberChef.git
synced 2025-05-10 08:15:00 -04:00
adding BraceMatching operation
This commit is contained in:
parent
8d0fcf37c5
commit
85b98f1111
4 changed files with 206 additions and 1 deletions
|
@ -90,6 +90,7 @@ import "./tests/Typex";
|
|||
import "./tests/BLAKE2b";
|
||||
import "./tests/BLAKE2s";
|
||||
import "./tests/Protobuf";
|
||||
import "./tests/BraceMatching";
|
||||
|
||||
// Cannot test operations that use the File type yet
|
||||
//import "./tests/SplitColourChannels";
|
||||
|
|
101
tests/operations/tests/BraceMatching.mjs
Normal file
101
tests/operations/tests/BraceMatching.mjs
Normal file
|
@ -0,0 +1,101 @@
|
|||
/**
|
||||
* Brace Matching tests.
|
||||
*
|
||||
* @author DBHeise [david@heiseink.com]
|
||||
* @copyright Crown Copyright 2019
|
||||
* @license Apache-2.0
|
||||
*/
|
||||
|
||||
import TestRegister from "../TestRegister";
|
||||
|
||||
TestRegister.addTests([
|
||||
{
|
||||
name: "Brace Matching Simple",
|
||||
input: "(test)",
|
||||
expectedOutput: "test",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Brace Matching",
|
||||
"args": ["(", ")", "\"'", "\\"]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
name: "Brace Matching Simple with extra text",
|
||||
input: "this is a simple (test) of this function",
|
||||
expectedOutput: "test",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Brace Matching",
|
||||
"args": ["(", ")", "\"'", "\\"]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
name: "Brace Matching Simple with strings",
|
||||
input: "{test \"}\"}",
|
||||
expectedOutput: "test \"}\"",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Brace Matching",
|
||||
"args": ["{", "}", "\"'", "\\"]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
name: "Brace Matching Simple with strings 2",
|
||||
input: "{test '}'}",
|
||||
expectedOutput: "test '}'",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Brace Matching",
|
||||
"args": ["{", "}", "\"'", "\\"]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
name: "Brace Matching Simple nested",
|
||||
input: "[this [test] good]",
|
||||
expectedOutput: "this [test] good",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Brace Matching",
|
||||
"args": ["[", "]", "\"'", "\\"]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
name: "Brace Matching Simple escaped",
|
||||
input: "<test \\> foo bar>",
|
||||
expectedOutput: "test \\> foo bar",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Brace Matching",
|
||||
"args": ["<", ">", "\"'", "\\"]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
name: "Brace Matching Complex multi nesting 1",
|
||||
input: "(((((test)))))(((((test)))))",
|
||||
expectedOutput: "((((test))))",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Brace Matching",
|
||||
"args": ["(", ")", "\"'", "\\"]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
name: "Brace Matching Complex multi nesting 2",
|
||||
input: "(((((test))))(((((test))))))",
|
||||
expectedOutput: "((((test))))(((((test)))))",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Brace Matching",
|
||||
"args": ["(", ")", "\"'", "\\"]
|
||||
}
|
||||
]
|
||||
}
|
||||
]);
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue