Source
/*
** Copyright (C) 2001-2025 Zabbix SIA
**
** This program is free software: you can redistribute it and/or modify it under the terms of
** the GNU Affero General Public License as published by the Free Software Foundation, version 3.
**
** This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
** without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
** See the GNU Affero General Public License for more details.
**
** You should have received a copy of the GNU Affero General Public License along with this program.
** If not, see <https://www.gnu.org/licenses/>.
**/
const char *request_parameter_type_to_str(zbx_request_parameter_type_t type);
const char *request_parameter_type_to_str(zbx_request_parameter_type_t type)
{
const char *ret = "undefined";
switch(type)
{
case REQUEST_PARAMETER_TYPE_STRING:
ret = "string";
break;
case REQUEST_PARAMETER_TYPE_ARRAY:
ret = "array";
break;
default:
break;
}
return ret;
}
void zbx_mock_test_entry(void **state)
{
zbx_mock_error_t error;
zbx_mock_handle_t in_key, out_key, out_parameters, out_types;
AGENT_REQUEST request;
const char *item_key, *expected_key;
int expected_result = 123, actual_result;
ZBX_UNUSED(state);
if (ZBX_MOCK_SUCCESS != (error = zbx_mock_in_parameter("key", &in_key)) ||
ZBX_MOCK_SUCCESS != (error = zbx_mock_string(in_key, &item_key)))
{
fail_msg("Cannot get item key from test case data: %s", zbx_mock_error_string(error));
}
if (ZBX_MOCK_NO_PARAMETER == (error = zbx_mock_out_parameter("key", &out_key)))
expected_result = FAIL;
else if (ZBX_MOCK_SUCCESS != error || ZBX_MOCK_SUCCESS != (error = zbx_mock_string(out_key, &expected_key)))
fail_msg("Cannot get expected key from test case data: %s", zbx_mock_error_string(error));
else
expected_result = SUCCEED;