merge 8.0.1 release -> node-lib

This commit is contained in:
d98762625 2018-08-11 22:15:09 +01:00
commit 7c1ac4392e
63 changed files with 4608 additions and 4331 deletions

View file

@ -78,11 +78,15 @@ class TestRegister {
ret.output = "Expected an error but did not receive one.";
} else if (result.result === test.expectedOutput) {
ret.status = "passing";
} else if (test.hasOwnProperty("expectedMatch") && test.expectedMatch.test(result.result)) {
ret.status = "passing";
} else {
ret.status = "failing";
const expected = test.expectedOutput ? test.expectedOutput :
test.expectedMatch ? test.expectedMatch.toString() : "unknown";
ret.output = [
"Expected",
"\t" + test.expectedOutput.replace(/\n/g, "\n\t"),
"\t" + expected.replace(/\n/g, "\n\t"),
"Received",
"\t" + result.result.replace(/\n/g, "\n\t"),
].join("\n");

View file

@ -44,6 +44,7 @@ import "./tests/operations/ConditionalJump";
import "./tests/operations/Register";
import "./tests/operations/Comment";
import "./tests/operations/Hash";
import "./tests/operations/HaversineDistance";
import "./tests/operations/Hexdump";
import "./tests/operations/Image";
import "./tests/operations/MorseCode";
@ -61,6 +62,7 @@ import "./tests/operations/SetDifference";
import "./tests/operations/SetIntersection";
import "./tests/operations/SetUnion";
import "./tests/operations/SymmetricDifference";
import "./tests/operations/Magic";
import "./tests/nodeApi/nodeApi";
import "./tests/nodeApi/ops";

View file

@ -0,0 +1,22 @@
/**
* Haversine distance tests.
*
* @author Dachande663 [dachande663@gmail.com]
* @copyright Crown Copyright 2018
* @license Apache-2.0
*/
import TestRegister from "../../TestRegister";
TestRegister.addTests([
{
name: "Haversine distance",
input: "51.487263,-0.124323, 38.9517,-77.1467",
expectedOutput: "5619355.701829259",
recipeConfig: [
{
"op": "Haversine distance",
"args": []
}
],
}
]);

View file

@ -0,0 +1,57 @@
/**
* Magic tests.
*
* @author n1474335 [n1474335@gmail.com]
*
* @copyright Crown Copyright 2018
* @license Apache-2.0
*/
import TestRegister from "../../TestRegister";
TestRegister.addTests([
{
name: "Magic: nothing",
input: "",
expectedOutput: "Nothing of interest could be detected about the input data.\nHave you tried modifying the operation arguments?",
recipeConfig: [
{
op: "Magic",
args: [3, false, false]
}
],
},
{
name: "Magic: hex",
input: "41 42 43 44 45",
expectedMatch: /"#recipe=From_Hex\('Space'\)"/,
recipeConfig: [
{
op: "Magic",
args: [3, false, false]
}
],
},
{
name: "Magic: jpeg",
input: "\xFF\xD8\xFF",
expectedMatch: /Render_Image\('Raw'\)/,
recipeConfig: [
{
op: "Magic",
args: [3, false, false]
}
],
},
{
name: "Magic: mojibake",
input: "d091d18bd100d182d180d0b0d10020d0bad0bed180d0b8d187d0bdd0b5d0b2d0b0d10020d0bbd0b8d100d0b020d0bfd180d18bd0b3d0b0d0b5d18220d187d0b5d180d0b5d0b720d0bbd0b5d0bdd0b8d0b2d183d18e20d100d0bed0b1d0b0d0bad1832e",
expectedMatch: /Быртрар коричневар лира прыгает через ленивую робаку./,
recipeConfig: [
{
op: "Magic",
args: [3, true, false]
}
],
},
]);