#include "zbxmockassert.h"
#include "zbxcacheconfig.h"
int zbx_dc_function_calculate_nextcheck(const zbx_trigger_timer_t *timer, time_t from, zbx_uint64_t seed);
#define ZBX_TRIGGER_TIMER_TRIGGER 0x0001
#define ZBX_TRIGGER_TIMER_FUNCTION_TIME 0x0002
#define ZBX_TRIGGER_TIMER_FUNCTION_TREND 0x0004
static int str_to_timer_type(const char *str)
if (0 == strcmp(str, "ZBX_TRIGGER_TIMER_TRIGGER"))
return ZBX_TRIGGER_TIMER_TRIGGER;
if (0 == strcmp(str, "ZBX_TRIGGER_TIMER_FUNCTION_TIME"))
return ZBX_TRIGGER_TIMER_FUNCTION_TIME;
if (0 == strcmp(str, "ZBX_TRIGGER_TIMER_FUNCTION_TREND"))
return ZBX_TRIGGER_TIMER_FUNCTION_TREND;
fail_msg("unknown timer type \"%s\"", str);
return ZBX_FUNCTION_TYPE_UNKNOWN;
void zbx_mock_test_entry(void **state)
zbx_timespec_t ts_from, ts_returned, ts_expected;
zbx_trigger_timer_t timer = {0};
if (0 != setenv("TZ", zbx_mock_get_parameter_string("in.timezone"), 1))
fail_msg("Cannot set 'TZ' environment variable: %s", zbx_strerror(errno));
if (ZBX_MOCK_SUCCESS != zbx_strtime_to_timespec(zbx_mock_get_parameter_string("in.time"), &ts_from))
fail_msg("Invalid input time format");
timer.type = str_to_timer_type(zbx_mock_get_parameter_string("in.type"));
timer.parameter = zbx_mock_get_parameter_string("in.params");