20 run_one_test(
const char *t,
const char *x,
int expected) {
31 no_time_given(
void **state) {
36 any_time_satisfies_empty_spec(
void **state) {
45 time_satisfies_year_spec(
void **state) {
46 run_one_test(
"2020-01-01",
52 time_after_year_spec(
void **state) {
53 run_one_test(
"2020-01-01",
59 time_satisfies_year_range(
void **state) {
60 run_one_test(
"2020-01-01",
61 "<date_spec " XML_ATTR_ID "='spec' years='2010-2030'/>",
66 time_before_year_range(
void **state) {
67 run_one_test(
"2000-01-01",
68 "<date_spec " XML_ATTR_ID "='spec' years='2010-2030'/>",
73 time_after_year_range(
void **state) {
74 run_one_test(
"2020-01-01",
75 "<date_spec " XML_ATTR_ID "='spec' years='2010-2015'/>",
80 range_without_start_year_passes(
void **state) {
81 run_one_test(
"2010-01-01",
82 "<date_spec " XML_ATTR_ID "='spec' years='-2020'/>",
87 range_without_end_year_passes(
void **state) {
88 run_one_test(
"2010-01-01",
89 "<date_spec " XML_ATTR_ID "='spec' years='2000-'/>",
91 run_one_test(
"2000-10-01",
92 "<date_spec " XML_ATTR_ID "='spec' years='2000-'/>",
97 yeardays_satisfies(
void **state) {
98 run_one_test(
"2020-01-30",
99 "<date_spec " XML_ATTR_ID "='spec' yeardays='30'/>",
104 time_after_yeardays_spec(
void **state) {
105 run_one_test(
"2020-02-15",
106 "<date_spec " XML_ATTR_ID "='spec' yeardays='40'/>",
111 yeardays_feb_29_satisfies(
void **state) {
112 run_one_test(
"2016-02-29",
113 "<date_spec " XML_ATTR_ID "='spec' yeardays='60'/>",
118 exact_ymd_satisfies(
void **state) {
119 run_one_test(
"2001-12-31",
120 "<date_spec " XML_ATTR_ID "='spec' years='2001' months='12' " 126 range_in_month_satisfies(
void **state) {
127 run_one_test(
"2001-06-10",
128 "<date_spec " XML_ATTR_ID "='spec' years='2001' months='6' " 129 "monthdays='1-10'/>",
134 exact_ymd_after_range(
void **state) {
135 run_one_test(
"2001-12-31",
136 "<date_spec " XML_ATTR_ID "='spec' years='2001' months='12' " 142 time_after_monthdays_range(
void **state) {
143 run_one_test(
"2001-06-10",
144 "<date_spec " XML_ATTR_ID "='spec' years='2001' months='6' " 145 "monthdays='11-15'/>",
150 cmocka_unit_test(no_time_given),
151 cmocka_unit_test(any_time_satisfies_empty_spec),
152 cmocka_unit_test(time_satisfies_year_spec),
153 cmocka_unit_test(time_after_year_spec),
154 cmocka_unit_test(time_satisfies_year_range),
155 cmocka_unit_test(time_before_year_range),
156 cmocka_unit_test(time_after_year_range),
157 cmocka_unit_test(range_without_start_year_passes),
158 cmocka_unit_test(range_without_end_year_passes),
159 cmocka_unit_test(yeardays_satisfies),
160 cmocka_unit_test(time_after_yeardays_spec),
161 cmocka_unit_test(yeardays_feb_29_satisfies),
162 cmocka_unit_test(exact_ymd_satisfies),
163 cmocka_unit_test(range_in_month_satisfies),
164 cmocka_unit_test(exact_ymd_after_range),
165 cmocka_unit_test(time_after_monthdays_range))
struct crm_time_s crm_time_t
PCMK__UNIT_TEST(NULL, NULL, cmocka_unit_test(bad_input), cmocka_unit_test(not_found), cmocka_unit_test(find_attrB), cmocka_unit_test(find_attrA_matching))
xmlNode * string2xml(const char *input)
int pe_cron_range_satisfied(const crm_time_t *now, const xmlNode *cron_spec)
Wrappers for and extensions to libxml2.
void free_xml(xmlNode *child)
crm_time_t * crm_time_new(const char *string)
void crm_time_free(crm_time_t *dt)