Equation
The value associated with the given (key
) shall satisfy the specified (equation
).
Parameter table
param | unit | required | description |
---|---|---|---|
eqKeys | yes | The keys of the values to check against an equation. | |
equation | yes | The equation to satisfy. |
How to setup
The rule verifies whether the values associated with the specified (eqKeys
)
satisfy the specified (equation
).
If the equation/inequality is not satisfied, the rule will fail.
The equation/inequality is specified as a string, where the left side
is separated from the right side by a symbol.
The symbol can be one of the following: =
, ==
, !=
, ≥
, <=
, >
, <
, >=
.
Each side can be a simple arithmetic expression, or a complex equation.
Note: Make sure your variables are consistent with the keys you specified in eqKeys
.
Examples
value | valid | eqKeys | equation | description |
---|---|---|---|---|
\{x: 5, y: 5, z: 10\} | ✅ | (x, y, z) | x + y = z | The equation is satisfied. |
\{x: 5, y: 6, z: 10\} | ❌ | (x, y, z) | x + y = z | The equation is not satisfied. |
\{x: 5, y: 5, z: 10\} | ✅ | (x, y, z) | x + y ≤ z | The inequality is satisfied. |
\{x: 5, y: 6, z: 12\} | ❌ | (x, y, z) | x + y ≥ z | The inequality is not satisfied. |
\{hardwork: 6, skill: 5\} | ✅ | (skill, hardwork) | skill < hardwork | The inequality is satisfied. |
\{power: 10, speed: 5, strength: 5\} | ❌ | (power, strength, speed) | power > strength + speed | The inequality is not satisfied. |