20 assert_add_years(
const char *orig_date_time,
int years,
21 const char *expected_date_time)
26 assert_non_null(orig);
27 assert_non_null(expected);
37 invalid_argument(
void **state)
43 add_positive(
void **state)
45 assert_add_years(
"2024-01-01 00:30:00 +01:00", 1,
46 "2025-01-01 00:30:00 +01:00");
48 assert_add_years(
"2024-12-31 01:40:50 +02:00", 1000,
49 "3024-12-31 01:40:50 +02:00");
53 add_negative(
void **state)
55 assert_add_years(
"2024-01-01 00:30:00 +01:00", -1,
56 "2023-01-01 00:30:00 +01:00");
58 assert_add_years(
"2024-12-31 01:40:50 +02:00", -1000,
59 "1024-12-31 01:40:50 +02:00");
63 out_of_range(
void **state)
65 char *expected_datetime = NULL;
68 assert_add_years(
"2024-01-01 00:00:00 +00:00", INT_MAX, expected_datetime);
69 free(expected_datetime);
71 assert_add_years(
"2024-01-01 00:00:00 +00:00", -3000,
72 "01-01-01 00:00:00 +00:00");
76 cmocka_unit_test(invalid_argument),
77 cmocka_unit_test(add_positive),
78 cmocka_unit_test(add_negative),
79 cmocka_unit_test(out_of_range));
void crm_time_add_years(crm_time_t *dt, int value)
struct crm_time_s crm_time_t
char * crm_strdup_printf(char const *format,...) G_GNUC_PRINTF(1
#define pcmk__assert_asserts(stmt)
int crm_time_compare(const crm_time_t *a, const crm_time_t *b)
PCMK__UNIT_TEST(NULL, NULL, cmocka_unit_test(invalid_argument), cmocka_unit_test(add_positive), cmocka_unit_test(add_negative), cmocka_unit_test(out_of_range))
crm_time_t * crm_time_new(const char *string)
void crm_time_free(crm_time_t *dt)