4 static int test_filemetatype2string_must_fail(const isds_FileMetaType type
) {
7 string
= (xmlChar
*) isds_FileMetaType2string(type
);
9 FAIL_TEST("conversion from isds_FileMetaType to string did not fail");
14 static int test_string2filemetatype_must_fail(const xmlChar
*string
) {
16 isds_FileMetaType new_type
;
18 err
= string2isds_FileMetaType((xmlChar
*)string
, &new_type
);
20 FAIL_TEST("conversion from string to isds_FileMetaType did not fail");
25 static int test_filemetatype(const isds_FileMetaType type
) {
28 isds_FileMetaType new_type
;
30 string
= (xmlChar
*) isds_FileMetaType2string(type
);
32 FAIL_TEST("conversion from isds_FileMetaType to string failed");
34 err
= string2isds_FileMetaType(string
, &new_type
);
36 FAIL_TEST("conversion from string to isds_FileMetaTyoe failed");
39 FAIL_TEST("double conversion not idempotent");
44 int main(int argc
, char **argv
) {
45 INIT_TEST("isds_FileMetaType conversion");
47 isds_FileMetaType types
[] = {
48 FILEMETATYPE_MAIN
, /* Main document */
49 FILEMETATYPE_ENCLOSURE
, /* Appendix */
50 FILEMETATYPE_SIGNATURE
, /* Digital signature of other document */
51 FILEMETATYPE_META
/* XML document for ESS (electronic */
54 for (int i
= 0; i
< sizeof(types
)/sizeof(types
[0]); i
++)
55 TEST(isds_FileMetaType2string(types
[i
]), test_filemetatype
, types
[i
]);
57 TEST("1234", test_filemetatype2string_must_fail
, 1234);
59 TEST("X-Invalid_Type", test_string2filemetatype_must_fail
,
60 BAD_CAST
"X-Invalid_Type");