diff options
author | Artjoms Rimdjonoks <artjoms.rimdjonoks@zabbix.com> | 2020-03-30 10:39:18 +0300 |
---|---|---|
committer | Artjoms Rimdjonoks <artjoms.rimdjonoks@zabbix.com> | 2020-03-30 10:41:55 +0300 |
commit | de87cf7a99b0449fa85bd418d990275e45519f4a (patch) | |
tree | 04184548efe8d823493b328534a0ef89ee2bb3ce /tests | |
parent | cd21795f75dbc8eeea06a07f50da16f4bc8001ec (diff) |
........S. [ZBXNEXT-702] added scientific notation tests
Diffstat (limited to 'tests')
-rw-r--r-- | tests/libs/zbxalgo/evaluate.yaml | 76 | ||||
-rw-r--r-- | tests/libs/zbxdbcache/zbx_dc_expand_user_macros_for_triggers.yaml | 9 | ||||
-rwxr-xr-x | tests/libs/zbxserver/get_trigger_expression_constant.yaml | 7 |
3 files changed, 90 insertions, 2 deletions
diff --git a/tests/libs/zbxalgo/evaluate.yaml b/tests/libs/zbxalgo/evaluate.yaml index e103b5d6d87..7b730d19838 100644 --- a/tests/libs/zbxalgo/evaluate.yaml +++ b/tests/libs/zbxalgo/evaluate.yaml @@ -280,6 +280,78 @@ out: value: 0 return: 'SUCCEED' +# scientific notation tests +--- +test case: 'scientific notation, simple comparison' +in: + expression: '"1e+0"=1' +out: + value: 1 + return: 'SUCCEED' +--- +test case: 'scientific notation, large int number' +in: + expression: '"1e+40"=10000000000000000000000000000000000000000' +out: + value: 1 + return: 'SUCCEED' +--- +test case: 'scientific notation, large string number' +in: + expression: '"1e+40"="10000000000000000000000000000000000000000"' +out: + value: 1 + return: 'SUCCEED' +--- +test case: 'scientific notation, negative exponent' +in: + expression: '"1e-40"="0.00000000000000000000000000000000000000001"' +out: + value: 1 + return: 'SUCCEED' +--- +test case: 'scientific notation, precision limit holds' +in: + expression: '"1e+40"=10000000000000001000000000000000000000000' +out: + value: 0 + return: 'SUCCEED' +--- +test case: 'scientific notation, precision limit does not hold' +in: + expression: '"1e+40"=10000000000000000100000000000000000000000' +out: + value: 1 + return: 'SUCCEED' +--- +test case: 'scientific notation, precision limit does not hold 2' +in: + expression: '"1e+40"<>10000000000000000000000000000000000000001' +out: + value: 0 + return: 'SUCCEED' +--- +test case: 'scientific notation, negative number' +in: + expression: '-10000000000000000000000000000000000000000="-1e+40"' +out: + value: 1 + return: 'SUCCEED' +--- +test case: 'scientific notation, negative number 2' +in: + expression: '-10000000000000000000000000000000000000000="1e+40"' +out: + value: 0 + return: 'SUCCEED' +--- +test case: 'scientific notation, addition' +in: + expression: '("-1e+40"+10000000000000000000000000000000000000000)=0' +out: + value: 1 + return: 'SUCCEED' + # '-' operator tests --- test case: 'term 8, one on its own' @@ -1426,9 +1498,9 @@ out: value: 1 return: 'SUCCEED' --- -test case: 'Valid expression "-5 + 10 * -6 - 700 / (49 * (1 / (2 + 5))) = -165"' +test case: 'Valid expression "-5 + 10 * -6 + 1e+2 + "1e+3" - 700 / (49 * (1 / (2 + 5))) = 935"' in: - expression: '-5 + 10 * -6 - 700 / (49 * (1 / (2 + 5))) = -165' + expression: '-5 + 10 * -6 + 1e+2 + "1e+3" - 700 / (49 * (1 / (2 + 5))) = 935' out: value: 1 return: 'SUCCEED' diff --git a/tests/libs/zbxdbcache/zbx_dc_expand_user_macros_for_triggers.yaml b/tests/libs/zbxdbcache/zbx_dc_expand_user_macros_for_triggers.yaml index 3499820566c..20ba4d2a7dc 100644 --- a/tests/libs/zbxdbcache/zbx_dc_expand_user_macros_for_triggers.yaml +++ b/tests/libs/zbxdbcache/zbx_dc_expand_user_macros_for_triggers.yaml @@ -178,4 +178,13 @@ in: expression: '{1} < {$A:"x:\"1\""}' out: expression: '{1} < {$A:"x:\"1\""}' +--- +test case: Expand '{2000} < {$A}' with {$A}=2e+3 +in: + macros: + - name: '{$A}' + value: 2000 + expression: '{2000} < {$A}' +out: + expression: '{2000} < 2000' ... diff --git a/tests/libs/zbxserver/get_trigger_expression_constant.yaml b/tests/libs/zbxserver/get_trigger_expression_constant.yaml index b608d7836c6..bb0e052964c 100755 --- a/tests/libs/zbxserver/get_trigger_expression_constant.yaml +++ b/tests/libs/zbxserver/get_trigger_expression_constant.yaml @@ -180,4 +180,11 @@ in: index: 1 out: return: '' +--- +test case: 'string constant -10e-10' +in: + expression: '{TRIGGER.VALUE}=1 and {19928}<>"-10e-10"' + index: 2 +out: + return: '-10e-10' ... |