#include "zbxmockhelper.h"
#include "../../../../src/libs/zbxsysinfo/sysinfo.h"
static int read_yaml_ret(void)
zbx_mock_handle_t handle;
if (ZBX_MOCK_SUCCESS != (error = zbx_mock_out_parameter("ret", &handle)))
fail_msg("Cannot get return code: %s", zbx_mock_error_string(error));
if (ZBX_MOCK_SUCCESS != (error = zbx_mock_string(handle, &str)))
fail_msg("Cannot read return code: %s", zbx_mock_error_string(error));
if (0 == strcasecmp(str, "succeed"))
if (0 != strcasecmp(str, "fail"))
fail_msg("Incorrect return code '%s'", str);
void zbx_mock_test_entry(void **state)
const char *itemkey = "system.cpu.intr";
zbx_init_agent_result(&result);
zbx_init_agent_request(&request);
zbx_init_library_sysinfo(NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
if (SUCCEED != zbx_parse_item_key(itemkey, &request))
fail_msg("Invalid item key format '%s'", itemkey);
if (read_yaml_ret() != (ret = system_cpu_intr(&request, &result)))
fail_msg("unexpected return code '%s'", zbx_sysinfo_ret_string(ret));