Source
zbx_mock_assert_str_eq("zbx_variant_compare() return", zbx_mock_get_parameter_string("out.return"),
/*
** Zabbix
** Copyright (C) 2001-2023 Zabbix SIA
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
**
** 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 General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
**/
static unsigned int hex2num(char c)
{
int res;
if (c >= 'a')
res = c - 'a' + 10; /* a-f */
else if (c >= 'A')
res = c - 'A' + 10; /* A-F */
else
res = c - '0'; /* 0-9 */
return (unsigned int)res;
}
static void mock_read_variant(const char *path, zbx_variant_t *variant)
{
zbx_mock_handle_t hvalue;
const char *type;
const char *value;
hvalue = zbx_mock_get_parameter_handle(path);
type = zbx_mock_get_object_member_string(hvalue, "type");
if (0 == strcmp(type, "ZBX_VARIANT_NONE"))
{
zbx_variant_set_none(variant);
return;
}
value = zbx_mock_get_object_member_string(hvalue, "value");
if (0 == strcmp(type, "ZBX_VARIANT_STR"))
{
zbx_variant_set_str(variant, zbx_strdup(NULL, value));
return;
}