21 run_one_test(
const char *t,
const char *x,
int expected)
33 null_invalid(
void **state)
49 spec_id_missing(
void **state)
52 run_one_test(
"2020-01-01",
"<date_spec years='2020'/>",
pcmk_rc_ok);
56 invalid_range(
void **state)
59 run_one_test(
"2020-01-01",
"<date_spec years='not-a-year' months='1'/>",
64 time_satisfies_year_spec(
void **state)
66 run_one_test(
"2020-01-01",
67 "<date_spec " PCMK_XA_ID "='spec' years='2020'/>",
72 time_after_year_spec(
void **state)
74 run_one_test(
"2020-01-01",
82 time_satisfies_year_range(
void **state)
84 run_one_test(
"2020-01-01",
92 time_before_year_range(
void **state)
94 run_one_test(
"2000-01-01",
102 time_after_year_range(
void **state)
104 run_one_test(
"2020-01-01",
112 range_without_start_year_passes(
void **state)
114 run_one_test(
"2010-01-01",
122 range_without_end_year_passes(
void **state)
124 run_one_test(
"2010-01-01",
129 run_one_test(
"2000-10-01",
137 yeardays_satisfies(
void **state)
139 run_one_test(
"2020-01-30",
147 time_after_yeardays_spec(
void **state)
149 run_one_test(
"2020-02-15",
157 yeardays_feb_29_satisfies(
void **state)
159 run_one_test(
"2016-02-29",
167 exact_ymd_satisfies(
void **state)
169 run_one_test(
"2001-12-31",
179 range_in_month_satisfies(
void **state)
181 run_one_test(
"2001-06-10",
191 exact_ymd_after_range(
void **state)
193 run_one_test(
"2001-12-31",
203 time_after_monthdays_range(
void **state)
205 run_one_test(
"2001-06-10",
215 cmocka_unit_test(null_invalid),
216 cmocka_unit_test(spec_id_missing),
217 cmocka_unit_test(invalid_range),
218 cmocka_unit_test(time_satisfies_year_spec),
219 cmocka_unit_test(time_after_year_spec),
220 cmocka_unit_test(time_satisfies_year_range),
221 cmocka_unit_test(time_before_year_range),
222 cmocka_unit_test(time_after_year_range),
223 cmocka_unit_test(range_without_start_year_passes),
224 cmocka_unit_test(range_without_end_year_passes),
225 cmocka_unit_test(yeardays_satisfies),
226 cmocka_unit_test(time_after_yeardays_spec),
227 cmocka_unit_test(yeardays_feb_29_satisfies),
228 cmocka_unit_test(exact_ymd_satisfies),
229 cmocka_unit_test(range_in_month_satisfies),
230 cmocka_unit_test(exact_ymd_after_range),
231 cmocka_unit_test(time_after_monthdays_range))
G_GNUC_INTERNAL int pcmk__evaluate_date_spec(const xmlNode *date_spec, const crm_time_t *now)
struct crm_time_s crm_time_t
#define PCMK__UNIT_TEST(group_setup, group_teardown,...)
#define PCMK_XE_DATE_SPEC
int pcmk__xml_test_setup_group(void **state)
Wrappers for and extensions to libxml2.
void free_xml(xmlNode *child)
int pcmk__xml_test_teardown_group(void **state)
xmlNode * pcmk__xml_parse(const char *input)
#define PCMK_XA_MONTHDAYS
crm_time_t * crm_time_new(const char *string)
void crm_time_free(crm_time_t *dt)