5 static int test_filemetatype2string_must_fail(const isds_FileMetaType type
) {
8 string
= (xmlChar
*) isds_FileMetaType2string(type
);
10 FAIL_TEST("conversion from isds_FileMetaType to string did not fail");
16 static int test_string2filemetatype_must_fail(const xmlChar
*string
) {
18 isds_FileMetaType new_type
;
20 err
= string2isds_FileMetaType((xmlChar
*)string
, &new_type
);
22 FAIL_TEST("conversion from string to isds_FileMetaType did not fail");
27 static int test_filemetatype(const isds_FileMetaType type
,
28 const xmlChar
*string
) {
30 isds_FileMetaType new_type
;
34 new_string
= (xmlChar
*) isds_FileMetaType2string(type
);
36 FAIL_TEST("conversion from isds_FileMetaType to string failed");
37 if (xmlStrcmp(string
, new_string
))
38 FAIL_TEST("conversion from isds_FileMetaType %zd to string returned "
39 "unexpected value: got=`%s', expected=`%s'",
40 type
, new_string
, string
);
41 #endif /* HAVE_LIBCURL */
43 err
= string2isds_FileMetaType(string
, &new_type
);
45 FAIL_TEST("conversion from string to isds_FileMetaTyoe failed");
47 FAIL_TEST("conversion from string `%s' to isds_FileMetaType returned "
48 "unexpected valued: got=%zd, expected=%zd",
49 string
, new_type
, type
);
55 INIT_TEST("isds_FileMetaType conversion");
57 isds_FileMetaType types
[] = {
58 FILEMETATYPE_MAIN
, /* Main document */
59 FILEMETATYPE_ENCLOSURE
, /* Appendix */
60 FILEMETATYPE_SIGNATURE
, /* Digital signature of other document */
61 FILEMETATYPE_META
/* XML document for ESS (electronic */
63 const xmlChar
*strings
[] = {
70 for (size_t i
= 0; i
< sizeof(types
)/sizeof(types
[0]); i
++)
71 TEST(strings
[i
], test_filemetatype
, types
[i
], strings
[i
]);
74 TEST("1234", test_filemetatype2string_must_fail
, 1234);
77 TEST("X-Invalid_Type", test_string2filemetatype_must_fail
,
78 BAD_CAST
"X-Invalid_Type");