17 #define TEST_TIME pcmk__time_hr_new("2024-01-02 03:04:05 +00:00")    32 assert_hr_format(
const char *format, 
const char *expected,
    33                  const char *alternate)
    40     if (expected == NULL) {
    47     if (alternate == NULL) {
    48         assert_string_equal(
result, expected);
    50         assert_true((strcmp(
result, expected) == 0)
    51                     || (strcmp(
result, alternate) == 0));
    58 null_format(
void **state)
    61     assert_hr_format(NULL, NULL, NULL); 
    65 no_specifiers(
void **state)
    67     assert_hr_format(
"no specifiers", 
"no specifiers", NULL);
    68     assert_hr_format(
"this has a literal % in it",
    69                      "this has a literal % in it",
    71                      "this has a literal  in it");
    72     assert_hr_format(
"this has a literal %01 in it",
    73                      "this has a literal %01 in it",
    75                      "this has a literal 1 in it");
    76     assert_hr_format(
"%2 this starts and ends with %",
    77                      "%2 this starts and ends with %",
    79                      "2 this starts and ends with %");
    84     assert_hr_format(
"this ends with %10", 
"this ends with        %10",
    90 without_nano(
void **state)
    92     assert_hr_format(
"%H:%M %a %b %d", 
"03:04 Tue Jan 02", NULL);
    93     assert_hr_format(
"%H:%M:%S", 
"03:04:05", NULL);
    94     assert_hr_format(
"The time is %H:%M right now",
    95                      "The time is 03:04 right now", NULL);
    96     assert_hr_format(
"%3S seconds", 
"005 seconds",
   101     assert_hr_format(
"%%H %%N", 
"%H %N", NULL);
   105 with_nano(
void **state)
   107     assert_hr_format(
"%H:%M:%S.%06N", 
"03:04:05.000000", NULL);
   108     assert_hr_format(
"The time is %H:%M:%S.%06N right NOW",
   109                      "The time is 03:04:05.000000 right NOW", NULL);
   113                 cmocka_unit_test(null_format),
   114                 cmocka_unit_test(no_specifiers),
   115                 cmocka_unit_test(without_nano),
   116                 cmocka_unit_test(with_nano))
 void pcmk__time_hr_free(pcmk__time_hr_t *hr_dt)
 
#define PCMK__UNIT_TEST(group_setup, group_teardown,...)
 
char * pcmk__time_format_hr(const char *format, const pcmk__time_hr_t *hr_dt)
 
pcmk__action_result_t result