4 static int test_datestring2tm(const xmlChar
*date
, const isds_error error
,
5 const struct tm
*correct_tm
, struct tm
*new_tm
) {
8 err
= _isds_datestring2tm(date
, new_tm
);
10 FAIL_TEST("_isds_datestring2tm() returned unexpected code: "
11 "expected=%s got=%s", isds_strerror(error
), isds_strerror(err
));
16 if (correct_tm
->tm_year
!= new_tm
->tm_year
)
17 FAIL_TEST("Returned struct tm differs in tm_year: expected=%d, got=%d",
18 correct_tm
->tm_year
, new_tm
->tm_year
);
19 if (correct_tm
->tm_mon
!= new_tm
->tm_mon
)
20 FAIL_TEST("Returned struct tm differs in tm_mon: expected=%d, got=%d",
21 correct_tm
->tm_mon
, new_tm
->tm_mon
);
22 if (correct_tm
->tm_mday
!= new_tm
->tm_mday
)
23 FAIL_TEST("Returned struct tm differs in tm_mday: expected=%d, got=%d",
24 correct_tm
->tm_mday
, new_tm
->tm_mday
);
30 INIT_TEST("ISO date string to tm conversion");
33 char *input
= "2001-02-03";
34 struct tm date
= {.tm_year
= 101, .tm_mon
= 1, .tm_mday
= 3};
35 TEST(input
, test_datestring2tm
, BAD_CAST input
, IE_SUCCESS
, &date
, &output
);
38 TEST(input
, test_datestring2tm
, BAD_CAST input
, IE_SUCCESS
, &date
, &output
);
41 TEST(input
, test_datestring2tm
, BAD_CAST input
, IE_SUCCESS
, &date
, &output
);
44 input
= "2001-02-03T05:06";
45 TEST(input
, test_datestring2tm
, BAD_CAST input
, IE_NOTSUP
, &date
, &output
);
48 TEST(input
, test_datestring2tm
, BAD_CAST input
, IE_NOTSUP
, &date
, &output
);
50 TEST("Empty input", test_datestring2tm
, BAD_CAST
"", IE_NOTSUP
, &date
,
54 TEST(input
, test_datestring2tm
, BAD_CAST input
, IE_INVAL
, &date
, &output
);
56 TEST("NULL output pointer", test_datestring2tm
, BAD_CAST
"", IE_INVAL
,