diff options
author | Aleksejs Sestakovs <aleksejs.sestakovs@zabbix.com> | 2021-05-19 15:54:37 +0300 |
---|---|---|
committer | Aleksejs Sestakovs <aleksejs.sestakovs@zabbix.com> | 2021-05-19 15:55:52 +0300 |
commit | bf4739a52f8fc91abc61029d7ffd99947d4a21cb (patch) | |
tree | ca08bebd9650240507ba08f065efe8d1f469a8f8 /tests/libs/zbxeval | |
parent | 298343feb0f4e9adf060d7761eea6bceb22669e3 (diff) |
........S. [ZBXNEXT-6546] fixed mid and insert trigger functions
* commit '39c6e7f5ff847575cb8b9b2eb34e93eb634dd34a':
........S. [ZBXNEXT-6546] fixed mid and insert trigger functions
(cherry picked from commit 60df7530fe06a07c2d79a424f34539f823dfbd72)
Diffstat (limited to 'tests/libs/zbxeval')
-rw-r--r-- | tests/libs/zbxeval/zbx_eval_execute.yaml | 166 |
1 files changed, 166 insertions, 0 deletions
diff --git a/tests/libs/zbxeval/zbx_eval_execute.yaml b/tests/libs/zbxeval/zbx_eval_execute.yaml index 9c75bfc7555..ca7f2307959 100644 --- a/tests/libs/zbxeval/zbx_eval_execute.yaml +++ b/tests/libs/zbxeval/zbx_eval_execute.yaml @@ -950,6 +950,14 @@ out: result: SUCCEED value: '1' --- +test case: Expression 'in("a", 3, "b", 1)' +in: + rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_VAR] + expression: 'in("a", 3, "b", 1)' +out: + result: SUCCEED + value: '0' +--- test case: Expression 'between(1, 1, 2)' in: rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_VAR] @@ -1075,6 +1083,61 @@ in: out: result: FAIL --- +test case: Expression 'left("Zabbix", 2.999999999)' +in: + rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_VAR] + expression: 'left("Zabbix", 2.999999999)' +out: + result: SUCCEED + value: 'Za' +--- +test case: Expression 'left("Zabbix", "")' +in: + rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_VAR] + expression: 'left("Zabbix", "")' +out: + result: FAIL +--- +test case: Expression 'left("", 1)' +in: + rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_VAR] + expression: 'left("", 1)' +out: + result: SUCCEED + value: '' +--- +test case: Expression 'left("Zabbix", 7)' +in: + rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_VAR] + expression: 'left("Zabbix", 7)' +out: + result: SUCCEED + value: 'Zabbix' +--- +test case: Expression 'left("Zabbix", 6)' +in: + rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_VAR] + expression: 'left("Zabbix", 6)' +out: + result: SUCCEED + value: 'Zabbix' +--- +test case: Expression 'left("Zabbix", 5)' +in: + rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_VAR] + expression: 'left("Zabbix", 5)' +out: + result: SUCCEED + value: 'Zabbi' +--- +test case: Expression 'left("Zabbix", 1)' +in: + rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_VAR] + expression: 'left("Zabbix", 1)' +out: + result: SUCCEED + value: 'Z' +--- test case: Expression 'mid("Zabbix", 3, 2)' in: rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_VAR] @@ -1129,6 +1192,38 @@ in: out: result: FAIL --- +test case: Expression 'mid("Zabbix", 2, 3)' +in: + rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_VAR] + expression: 'mid("Zabbix", 2, 3)' +out: + result: SUCCEED + value: 'abb' +--- +test case: Expression 'mid("Zabbix", 2, 4)' +in: + rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_VAR] + expression: 'mid("Zabbix", 2, 4)' +out: + result: SUCCEED + value: 'abbi' +--- +test case: Expression 'mid("Zabbix", 2, 5)' +in: + rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_VAR] + expression: 'mid("Zabbix", 2, 5)' +out: + result: SUCCEED + value: 'abbix' +--- +test case: Expression 'mid("Zabbix", 2, 6)' +in: + rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_VAR] + expression: 'mid("Zabbix", 2, 6)' +out: + result: SUCCEED + value: 'abbix' +--- test case: Expression 'right("Zabbix", 2)' in: rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_VAR] @@ -1177,6 +1272,38 @@ out: result: SUCCEED value: '' --- +test case: Expression 'right("Zabbix", 7)' +in: + rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_VAR] + expression: 'right("Zabbix", 7)' +out: + result: SUCCEED + value: 'Zabbix' +--- +test case: Expression 'right("Zabbix", 6)' +in: + rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_VAR] + expression: 'right("Zabbix", 6)' +out: + result: SUCCEED + value: 'Zabbix' +--- +test case: Expression 'right("Zabbix", 5)' +in: + rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_VAR] + expression: 'right("Zabbix", 5)' +out: + result: SUCCEED + value: 'abbix' +--- +test case: Expression 'right("Zabbix", 1)' +in: + rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_VAR] + expression: 'right("Zabbix", 1)' +out: + result: SUCCEED + value: 'x' +--- test case: Expression 'trim("zZabbixz", "z")' in: rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_VAR] @@ -1217,6 +1344,14 @@ out: result: SUCCEED value: 'Zabbix' --- +test case: Expression 'trim("")' +in: + rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_VAR] + expression: 'trim("")' +out: + result: SUCCEED + value: '' +--- test case: Expression 'ltrim(" Zabbix ", " ")' in: rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_VAR] @@ -1241,6 +1376,14 @@ out: result: SUCCEED value: 'Zabbix server' --- +test case: Expression 'concat("", "")' +in: + rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_VAR] + expression: 'concat("", "")' +out: + result: SUCCEED + value: '' +--- test case: Expression 'repeat("Zabbix", 3)' in: rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_VAR] @@ -1395,6 +1538,29 @@ in: out: result: FAIL --- +test case: Expression 'insert("Zbx", 3, 1, "i")' +in: + rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_VAR] + expression: 'insert("Zbx", 3, 1, "i")' +out: + result: SUCCEED + value: 'Zbi' +--- +test case: Expression 'insert("Zbx", 2, 2, "i")' +in: + rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_VAR] + expression: 'insert("Zbx", 2, 2, "i")' +out: + result: SUCCEED + value: 'Zi' +--- +test case: Expression 'insert("Zbx", 2, 3, "i")' +in: + rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_VAR] + expression: 'insert("Zbx", 2, 3, "i")' +out: + result: FAIL +--- test case: Expression 'replace("Zibix", "ibi", "abbi")' in: rules: [ZBX_EVAL_PARSE_FUNCTION,ZBX_EVAL_PARSE_VAR] |