Adding basic arithmetic operation

This commit is contained in:
BigYellowHammer 2021-10-05 17:17:30 +02:00
parent ae1b12c120
commit f9cbb6246b
6 changed files with 157 additions and 1 deletions

View file

@ -107,6 +107,7 @@ import "./tests/CBORDecode.mjs";
import "./tests/JA3Fingerprint.mjs";
import "./tests/JA3SFingerprint.mjs";
import "./tests/HASSH.mjs";
import "./tests/AddSubMulDivValue.mjs";
// Cannot test operations that use the File type yet

View file

@ -0,0 +1,50 @@
/**
* BitwiseOp tests
*
* @author BigYellowHammer
* @license Apache-2.0
*/
import TestRegister from "../../lib/TestRegister.mjs";
TestRegister.addTests([
{
name: "Add value",
input: "9",
expectedOutput: "11",
recipeConfig: [
{ "op": "Add/Subtract/Multiply/Divide by value",
"args": ["Add", "2"] },
]
},
{
name: "Subtract value",
input: "9",
expectedOutput: "7",
recipeConfig: [
{ "op": "Add/Subtract/Multiply/Divide by value",
"args": ["Subtract", "2"] },
]
},
{
name: "Multiply by value",
input: "9",
expectedOutput: "18",
recipeConfig: [
{ "op": "Add/Subtract/Multiply/Divide by value",
"args": ["Multiply", "2"] },
]
},
{
name: "Multiply by value",
input: "10",
expectedOutput: "5",
recipeConfig: [
{ "op": "Add/Subtract/Multiply/Divide by value",
"args": ["Divide", "2"] },
]
}
]);