6 static int test_normalize(const char *input
, const char *expected
) {
7 const char *output
= isds_normalize_mime_type(input
);
13 FAIL_TEST("isds_normalize_mime_type(%s) returned=%s, expected=%s",
14 input
, output
, expected
);
17 FAIL_TEST("isds_normalize_mime_type(%s) returned=%s, expected=%s",
18 input
, output
, expected
);
21 if (strcmp(expected
, output
)) {
22 FAIL_TEST("isds_normalize_mime_type(%s) returned=%s, expected=%s",
23 input
, output
, expected
);
30 int main(int argc
, char **argv
) {
31 INIT_TEST("normalize_mime_type");
33 TEST("NULL is idempotent", test_normalize
, NULL
, NULL
);
34 TEST("X-Invalid is idempotent", test_normalize
, "X-Invalid", "X-Invalid");
35 TEST("pdf", test_normalize
, "pdf", "application/pdf");
36 TEST("xml", test_normalize
, "xml", "application/xml");
37 TEST("fo", test_normalize
, "fo",
38 "application/vnd.software602.filler.xml+form");
39 TEST("zfo", test_normalize
, "zfo",
40 "application/vnd.software602.filler.xml+zip+form");
41 TEST("html", test_normalize
, "html", "text/html");
42 TEST("htm", test_normalize
, "htm", "text/html");
43 TEST("odt", test_normalize
, "odt",
44 "application/vnd.oasis.opendocument.text");
45 TEST("ods", test_normalize
, "ods",
46 "application/vnd.oasis.opendocument.spreadsheet");
47 TEST("odp", test_normalize
, "odp",
48 "application/vnd.oasis.opendocument.presentation");
49 TEST("txt", test_normalize
, "txt", "text/plain");
50 TEST("rtf", test_normalize
, "rtf", "application/rtf");
51 TEST("doc", test_normalize
, "doc", "application/msword");
52 TEST("xls", test_normalize
, "xls", "application/vnd.ms-excel");
53 TEST("ppt", test_normalize
, "ppt", "application/vnd.ms-powerpoint");
54 TEST("jpg", test_normalize
, "jpg", "image/jpeg");
55 TEST("jpeg", test_normalize
, "jpeg", "image/jpeg");
56 TEST("jfif", test_normalize
, "jfif", "image/jpeg");
57 TEST("png", test_normalize
, "png", "image/png");
58 TEST("tiff", test_normalize
, "tiff", "image/tiff");
59 TEST("gif", test_normalize
, "gif", "image/gif");
60 TEST("mpeg1", test_normalize
, "mpeg1", "video/mpeg");
61 TEST("mpeg2", test_normalize
, "mpeg2", "video/mpeg2");
62 TEST("wav", test_normalize
, "wav", "audio/x-wav");
63 TEST("mp2", test_normalize
, "mp2", "audio/mpeg");
64 TEST("mp3", test_normalize
, "mp3", "audio/mpeg");
65 TEST("isdoc", test_normalize
, "isdoc", "text/isdoc");
66 TEST("isdocx", test_normalize
, "isdocx", "text/isdocx");
67 TEST("cer", test_normalize
, "cer", "application/x-x509-ca-cert");
68 TEST("crt", test_normalize
, "crt", "application/x-x509-ca-cert");
69 TEST("der", test_normalize
, "der", "application/x-x509-ca-cert");
70 TEST("pk7", test_normalize
, "pk7", "application/pkcs7-mime");
71 TEST("p7b", test_normalize
, "p7b", "application/pkcs7-mime");
72 TEST("p7c", test_normalize
, "p7c", "application/pkcs7-mime");
73 TEST("p7f", test_normalize
, "p7f", "application/pkcs7-signature");
74 TEST("p7m", test_normalize
, "p7m", "application/pkcs7-mime");
75 TEST("p7s", test_normalize
, "p7s", "application/pkcs7-signature");
76 TEST("tst", test_normalize
, "tst", "application/timestamp-reply");