#include "zbxmocktest.h"
#include "zbxmockdata.h"
#include "zbxmockassert.h"
#include "zbxmockutil.h"
#include "zbxexpression.h"
#include "zbxcachevalue.h"
#include "mocks/valuecache/valuecache_mock.h"
#include "../../../src/libs/zbxexpression/anomalystl.h"
int __wrap_substitute_simple_macros(zbx_uint64_t *actionid, const zbx_db_event *event, const zbx_db_event *r_event,
zbx_uint64_t *userid, const zbx_uint64_t *hostid, const zbx_dc_host_t *dc_host,
const zbx_dc_item_t *dc_item, zbx_db_alert *alert, const zbx_db_acknowledge *ack,
const zbx_service_alarm_t *service_alarm, const zbx_db_service *service, const char *tz, char **data,
int macro_type, char *error, int maxerrlen);
int __wrap_zbx_dc_get_data_expected_from(zbx_uint64_t itemid, int *seconds);
int __wrap_substitute_simple_macros(zbx_uint64_t *actionid, const zbx_db_event *event, const zbx_db_event *r_event,
zbx_uint64_t *userid, const zbx_uint64_t *hostid, const zbx_dc_host_t *dc_host,
const zbx_dc_item_t *dc_item, zbx_db_alert *alert, const zbx_db_acknowledge *ack,
const zbx_service_alarm_t *service_alarm, const zbx_db_service *service, const char *tz, char **data,
int macro_type, char *error, int maxerrlen)
{
ZBX_UNUSED(actionid);
ZBX_UNUSED(event);
ZBX_UNUSED(r_event);
ZBX_UNUSED(userid);
ZBX_UNUSED(hostid);
ZBX_UNUSED(dc_host);
ZBX_UNUSED(dc_item);
ZBX_UNUSED(alert);
ZBX_UNUSED(ack);
ZBX_UNUSED(tz);
ZBX_UNUSED(data);
ZBX_UNUSED(macro_type);
ZBX_UNUSED(error);
ZBX_UNUSED(maxerrlen);
ZBX_UNUSED(service_alarm);
ZBX_UNUSED(service);
return SUCCEED;
}
int __wrap_zbx_dc_get_data_expected_from(zbx_uint64_t itemid, int *seconds)
{
ZBX_UNUSED(itemid);
*seconds = zbx_vcmock_get_ts().sec - 600;
return SUCCEED;
}
static void zbx_vcmock_history_dump(unsigned char value_type, const zbx_vector_history_record_t *values)
{
int i;
char buffer[256];
for (i = 0; i < values->values_num; i++)
{
const zbx_history_record_t *rec = &values->values[i];
zbx_timespec_to_strtime(&rec->timestamp, buffer, sizeof(buffer));
printf(" - %s\n", buffer);
zbx_history_value2str(buffer, sizeof(buffer), &rec->value, value_type);
printf(" %s\n", buffer);
}
}
static void read_values_stl(zbx_mock_handle_t hdata, unsigned char value_type, zbx_vector_history_record_t *values)
{
zbx_mock_error_t err;
zbx_mock_handle_t hvalue;
zbx_history_record_t rec;
const char *data;
ZBX_UNUSED(value_type);