diff options
author | Dmitrijs Goloscapovs <dmitrijs.goloscapovs@zabbix.com> | 2021-04-11 22:35:37 +0300 |
---|---|---|
committer | Dmitrijs Goloscapovs <dmitrijs.goloscapovs@zabbix.com> | 2021-04-11 22:40:45 +0300 |
commit | 60447549aabf636d18e18fc4df8c9f73907fe1ae (patch) | |
tree | 0f307cc4663358dd5eb638c32682d55afd5b1e9c /tests/libs/zbxeval | |
parent | 54b667d3763801fa20f28a12ee1d06f404e46bac (diff) |
........S. [ZBXNEXT-6544,ZBXNEXT-6545] fixed tests, added doc for functions
Diffstat (limited to 'tests/libs/zbxeval')
-rw-r--r-- | tests/libs/zbxeval/zbx_eval_execute.yaml | 289 |
1 files changed, 289 insertions, 0 deletions
diff --git a/tests/libs/zbxeval/zbx_eval_execute.yaml b/tests/libs/zbxeval/zbx_eval_execute.yaml index 05ff5b75833..ac82895705f 100644 --- a/tests/libs/zbxeval/zbx_eval_execute.yaml +++ b/tests/libs/zbxeval/zbx_eval_execute.yaml @@ -917,4 +917,293 @@ in: out: result: SUCCEED value: '30' +--- +test case: Expression 'sqrt(64)' +in: + rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_GROUP,ZBX_EVAL_PARSE_VAR] + expression: 'sqrt(64)' +out: + result: SUCCEED + value: 8 +--- +test case: Expression 'abs(3.5)' +in: + rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_GROUP,ZBX_EVAL_PARSE_VAR] + expression: 'abs(3.5)' +out: + result: SUCCEED + value: 3.5 +--- +test case: Expression 'cbrt(64)' +in: + rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_GROUP,ZBX_EVAL_PARSE_VAR] + expression: 'cbrt(64)' +out: + result: SUCCEED + value: 4 +--- +test case: Expression 'cbrt(63)' +in: + rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_GROUP,ZBX_EVAL_PARSE_VAR] + expression: 'cbrt(63)' +out: + result: SUCCEED + value: 3.9790572078963922 +--- +test case: Expression 'ceil(2)' +in: + rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_GROUP,ZBX_EVAL_PARSE_VAR] + expression: 'ceil(2)' +out: + result: SUCCEED + value: 2 +--- +test case: Expression 'ceil(2.5)' +in: + rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_GROUP,ZBX_EVAL_PARSE_VAR] + expression: 'ceil(2.5)' +out: + result: SUCCEED + value: 3 +--- +test case: Expression 'e()' +in: + rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_GROUP,ZBX_EVAL_PARSE_VAR] + expression: 'e()' +out: + result: SUCCEED + value: 2.7182818284590451 +--- +test case: Expression 'exp(2)' +in: + rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_GROUP,ZBX_EVAL_PARSE_VAR] + expression: 'exp(2)' +out: + result: SUCCEED + value: 7.38905609893065 +--- +test case: Expression 'expm1(2)' +in: + rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_GROUP,ZBX_EVAL_PARSE_VAR] + expression: 'expm1(2)' +out: + result: SUCCEED + value: 6.38905609893065 +--- +test case: Expression 'floor(2.6)' +in: + rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_GROUP,ZBX_EVAL_PARSE_VAR] + expression: 'floor(2.6)' +out: + result: SUCCEED + value: 2 +--- +test case: Expression 'log(2)' +in: + rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_GROUP,ZBX_EVAL_PARSE_VAR] + expression: 'log(2)' +out: + result: SUCCEED + value: 0.69314718055994529 +--- +test case: Expression 'log10(5)' +in: + rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_GROUP,ZBX_EVAL_PARSE_VAR] + expression: 'log10(5)' +out: + result: SUCCEED + value: 0.69897000433601886 +--- +test case: Expression 'pi()' +in: + rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_GROUP,ZBX_EVAL_PARSE_VAR] + expression: 'pi()' +out: + result: SUCCEED + value: 3.1415926535897931 +--- +test case: Expression 'power(2,3)' +in: + rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_GROUP,ZBX_EVAL_PARSE_VAR] + expression: 'power(2,3)' +out: + result: SUCCEED + value: 8 +--- +test case: Expression 'round(2.5482,2)' +in: + rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_GROUP,ZBX_EVAL_PARSE_VAR] + expression: 'round(2.5482,2)' +out: + result: SUCCEED + value: 2.55 +--- +test case: Expression 'signum(-2)' +in: + rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_GROUP,ZBX_EVAL_PARSE_VAR] + expression: 'signum(-2)' +out: + result: SUCCEED + value: -1 +--- +test case: Expression 'signum(2)' +in: + rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_GROUP,ZBX_EVAL_PARSE_VAR] + expression: 'signum(2)' +out: + result: SUCCEED + value: 1 +--- +test case: Expression 'signum(0)' +in: + rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_GROUP,ZBX_EVAL_PARSE_VAR] + expression: 'signum(0)' +out: + result: SUCCEED + value: 0 +--- +test case: Expression 'sqrt(3.5)' +in: + rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_GROUP,ZBX_EVAL_PARSE_VAR] + expression: 'sqrt(3.5)' +out: + result: SUCCEED + value: 1.8708286933869707 +--- +test case: Expression 'truncate(2.5482,2)' +in: + rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_GROUP,ZBX_EVAL_PARSE_VAR] + expression: 'truncate(2.5482,2)' +out: + result: SUCCEED + value: 2.54 +--- +test case: Expression 'acos(0.5)' +in: + rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_GROUP,ZBX_EVAL_PARSE_VAR] + expression: 'acos(0.5)' +out: + result: SUCCEED + value: 1.0471975511965979 +--- +test case: Expression 'asin(0.5)' +in: + rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_GROUP,ZBX_EVAL_PARSE_VAR] + expression: 'asin(0.5)' +out: + result: SUCCEED + value: 0.52359877559829893 +--- +test case: Expression 'atan(1)' +in: + rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_GROUP,ZBX_EVAL_PARSE_VAR] + expression: 'atan(1)' +out: + result: SUCCEED + value: 0.78539816339744828 +--- +test case: Expression 'atan2(3,2)' +in: + rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_GROUP,ZBX_EVAL_PARSE_VAR] + expression: 'atan2(3,2)' +out: + result: SUCCEED + value: 0.982793723247329 +--- +test case: Expression 'cos(1)' +in: + rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_GROUP,ZBX_EVAL_PARSE_VAR] + expression: 'cos(1)' +out: + result: SUCCEED + value: 0.54030230586813977 +--- +test case: Expression 'cosh(1)' +in: + rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_GROUP,ZBX_EVAL_PARSE_VAR] + expression: 'cosh(1)' +out: + result: SUCCEED + value: 1.5430806348152437 +--- +test case: Expression 'cot(1)' +in: + rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_GROUP,ZBX_EVAL_PARSE_VAR] + expression: 'cot(1)' +out: + result: SUCCEED + value: 0.64209261593433076 +--- +test case: Expression 'degrees(1)' +in: + rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_GROUP,ZBX_EVAL_PARSE_VAR] + expression: 'degrees(1)' +out: + result: SUCCEED + value: 57.295779513082323 +--- +test case: Expression 'radians(1)' +in: + rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_GROUP,ZBX_EVAL_PARSE_VAR] + expression: 'radians(1)' +out: + result: SUCCEED + value: 0.017453292519943295 +--- +test case: Expression 'sin(1)' +in: + rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_GROUP,ZBX_EVAL_PARSE_VAR] + expression: 'sin(1)' +out: + result: SUCCEED + value: 0.8414709848078965 +--- +test case: Expression 'sinh(1)' +in: + rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_GROUP,ZBX_EVAL_PARSE_VAR] + expression: 'sinh(1)' +out: + result: SUCCEED + value: 1.1752011936438014 +--- +test case: Expression 'tan(1)' +in: + rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_GROUP,ZBX_EVAL_PARSE_VAR] + expression: 'tan(1)' +out: + result: SUCCEED + value: 1.5574077246549023 +--- +test case: Expression 'mod(5,2)' +in: + rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_GROUP,ZBX_EVAL_PARSE_VAR] + expression: 'mod(5,2)' +out: + result: SUCCEED + value: 1 +--- +test case: Expression 'mod(5.5,2)' +in: + rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_GROUP,ZBX_EVAL_PARSE_VAR] + expression: 'mod(5.5,2)' +out: + result: SUCCEED + value: 1.5 +--- +test case: Expression 'mod(-5,-2)' +in: + rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_GROUP,ZBX_EVAL_PARSE_VAR] + expression: 'mod(-5,-2)' +out: + result: SUCCEED + value: -1 +--- +test case: Expression 'mod(-5.5,2)' +in: + rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_GROUP,ZBX_EVAL_PARSE_VAR] + expression: 'mod(-5.5,2)' +out: + result: SUCCEED + value: -1.5 + ... |