Levenshtein operation and operation search improved

This commit is contained in:
n1073645 2020-01-21 16:36:44 +00:00
parent ace8121d0e
commit 378c1ba07b
6 changed files with 195 additions and 6 deletions

View file

@ -96,7 +96,7 @@ import "./tests/DefangIP.mjs";
import "./tests/ParseUDP.mjs";
import "./tests/AvroToJSON.mjs";
import "./tests/Lorenz.mjs";
import "./tests/LevenshteinDistance.mjs";
// Cannot test operations that use the File type yet
// import "./tests/SplitColourChannels.mjs";

View file

@ -0,0 +1,44 @@
/**
* Levenshtein distance tests.
*
* @author n1073645 [n1073645@gmail.com]
* @copyright Crown Copyright 2020
* @license Apache-2.0
*/
import TestRegister from "../../lib/TestRegister.mjs";
TestRegister.addTests([
{
name: "Levenshtein Distance",
input: "the quick brown fox\n\nthequick br0wn g0x",
expectedOutput: "Levenshtein Distance: 4",
recipeConfig: [
{
"op": "Levenshtein Distance",
"args": []
}
],
},
{
name: "Levenshtein Distance",
input: "the quick brown fox\nthequick br0wn g0x",
expectedOutput: "Error: double newline not present.",
recipeConfig: [
{
"op": "Levenshtein Distance",
"args": []
}
],
},
{
name: "Levenshtein Distance",
input: "the quick brown fox\n\n",
expectedOutput: "Levenshtein Distance: 19",
recipeConfig: [
{
"op": "Levenshtein Distance",
"args": []
}
],
}
]);