mirror of
https://github.com/gchq/CyberChef.git
synced 2025-06-17 03:35:07 -04:00
Merge 3366fe3b02
into c57556f49f
This commit is contained in:
commit
adb64e7046
4 changed files with 236 additions and 1 deletions
|
@ -174,6 +174,7 @@ import "./tests/JA3Fingerprint.mjs";
|
|||
import "./tests/JA3SFingerprint.mjs";
|
||||
import "./tests/HASSH.mjs";
|
||||
import "./tests/JSONtoYAML.mjs";
|
||||
import "./tests/WordCount.mjs";
|
||||
|
||||
// Cannot test operations that use the File type yet
|
||||
// import "./tests/SplitColourChannels.mjs";
|
||||
|
|
117
tests/operations/tests/WordCount.mjs
Normal file
117
tests/operations/tests/WordCount.mjs
Normal file
|
@ -0,0 +1,117 @@
|
|||
/**
|
||||
* @author sw5678
|
||||
* @copyright Crown Copyright 2023
|
||||
* @license Apache-2.0
|
||||
*/
|
||||
import TestRegister from "../../lib/TestRegister.mjs";
|
||||
|
||||
TestRegister.addTests([
|
||||
{
|
||||
"name": "Word Count: Empty test 1",
|
||||
"input": "",
|
||||
"expectedOutput": "WORD,COUNT\nTOTAL,0",
|
||||
|
||||
"recipeConfig": [
|
||||
{
|
||||
"op": "Word Count",
|
||||
"args": ["Space", true, "Alphabetical"],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
"name": "Word Count: Empty test 2",
|
||||
"input": "",
|
||||
"expectedOutput": "WORD,COUNT\nTOTAL,0",
|
||||
|
||||
"recipeConfig": [
|
||||
{
|
||||
"op": "Word Count",
|
||||
"args": ["Space", true, "Count"],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
"name": "Word Count: Empty test 3",
|
||||
"input": "",
|
||||
"expectedOutput": "WORD,COUNT\n",
|
||||
|
||||
"recipeConfig": [
|
||||
{
|
||||
"op": "Word Count",
|
||||
"args": ["Space", false, "Alphabetical"],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
"name": "Word Count: Empty test 4",
|
||||
"input": "",
|
||||
"expectedOutput": "WORD,COUNT\n",
|
||||
|
||||
"recipeConfig": [
|
||||
{
|
||||
"op": "Word Count",
|
||||
"args": ["Space", false, "Count"],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
"name": "Word Count: Count test 1",
|
||||
"input": "Hello world. Hello. \n\n World, ''!@£$%^&*()_+=-[]{};'|:/.,<>? world",
|
||||
"expectedOutput": "WORD,COUNT\nhello,2\nworld,3\nTOTAL,5",
|
||||
|
||||
"recipeConfig": [
|
||||
{
|
||||
"op": "Word Count",
|
||||
"args": ["Space", true, "Alphabetical"],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
"name": "Word Count: Count test 2",
|
||||
"input": "Hello world. Hello. \n\n World, ''!@£$%^&*()_+=-[]{};'|:/.,<>? world",
|
||||
"expectedOutput": "WORD,COUNT\nworld,3\nhello,2\nTOTAL,5",
|
||||
|
||||
"recipeConfig": [
|
||||
{
|
||||
"op": "Word Count",
|
||||
"args": ["Space", true, "Count"],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
"name": "Word Count: Count test 3",
|
||||
"input": "Hello world. Hello. \n\n World, ''!@£$%^&*()_+=-[]{};'|:/.,<>? world",
|
||||
"expectedOutput": "WORD,COUNT\nhello,2\nworld,3\n",
|
||||
|
||||
"recipeConfig": [
|
||||
{
|
||||
"op": "Word Count",
|
||||
"args": ["Space", false, "Alphabetical"],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
"name": "Word Count: Count test 4",
|
||||
"input": "Hello world. Hello. \n\n World, ''!@£$%^&*()_+=-[]{};'|:/.,<>? world",
|
||||
"expectedOutput": "WORD,COUNT\nworld,3\nhello,2\n",
|
||||
|
||||
"recipeConfig": [
|
||||
{
|
||||
"op": "Word Count",
|
||||
"args": ["Space", false, "Count"],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
"name": "Word Count: Different delimiter test",
|
||||
"input": "Hello, World\nhello, world \n''!@£$%^&*()_+=-[]{};'|:/.,<>? world",
|
||||
"expectedOutput": "WORD,COUNT\nworld,3\nhello,2\n",
|
||||
|
||||
"recipeConfig": [
|
||||
{
|
||||
"op": "Word Count",
|
||||
"args": ["Comma", false, "Count"],
|
||||
},
|
||||
],
|
||||
}
|
||||
]);
|
Loading…
Add table
Add a link
Reference in a new issue