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("Normalization is not case-sensitive",
36 test_normalize
, "PdF", "application/pdf");
38 TEST("cer", test_normalize
, "cer", "application/x-x509-ca-cert");
39 TEST("crt", test_normalize
, "crt", "application/x-x509-ca-cert");
40 TEST("der", test_normalize
, "der", "application/x-x509-ca-cert");
41 TEST("doc", test_normalize
, "doc", "application/msword");
42 TEST("docx", test_normalize
, "docx",
43 "application/vnd.openxmlformats-officedocument.wordprocessingml.document");
44 TEST("dbf", test_normalize
, "dbf", "application/octet-stream")
45 TEST("prj", test_normalize
, "prj", "application/octet-stream")
46 TEST("qix", test_normalize
, "qix", "application/octet-stream")
47 TEST("sbx", test_normalize
, "sbx", "application/octet-stream")
48 TEST("shp", test_normalize
, "shp", "application/octet-stream")
49 TEST("shx", test_normalize
, "shx", "application/octet-stream")
50 TEST("dgn", test_normalize
, "dgn", "application/octet-stream")
51 TEST("dwg", test_normalize
, "dwg", "image/vnd.dwg")
52 TEST("edi", test_normalize
, "edi", "application/edifact")
53 TEST("fo", test_normalize
, "fo",
54 "application/vnd.software602.filler.form+xml");
55 TEST("gfs", test_normalize
, "gfs", "application/xml")
56 TEST("gml", test_normalize
, "gml", "application/xml")
57 TEST("gif", test_normalize
, "gif", "image/gif");
58 TEST("htm", test_normalize
, "htm", "text/html");
59 TEST("html", test_normalize
, "html", "text/html");
60 TEST("isdoc", test_normalize
, "isdoc", "text/isdoc");
61 TEST("isdocx", test_normalize
, "isdocx", "text/isdocx");
62 TEST("jfif", test_normalize
, "jfif", "image/jpeg");
63 TEST("jpeg", test_normalize
, "jpeg", "image/jpeg");
64 TEST("jpg", test_normalize
, "jpg", "image/jpeg");
65 TEST("mpeg", test_normalize
, "mpeg", "video/mpeg");
66 TEST("mpeg1", test_normalize
, "mpeg1", "video/mpeg");
67 TEST("mpeg2", test_normalize
, "mpeg2", "video/mpeg");
68 TEST("mpg", test_normalize
, "mpg", "video/mpeg");
69 TEST("mp2", test_normalize
, "mp2", "audio/mpeg");
70 TEST("mp3", test_normalize
, "mp3", "audio/mpeg");
71 TEST("odp", test_normalize
, "odp",
72 "application/vnd.oasis.opendocument.presentation");
73 TEST("ods", test_normalize
, "ods",
74 "application/vnd.oasis.opendocument.spreadsheet");
75 TEST("odt", test_normalize
, "odt",
76 "application/vnd.oasis.opendocument.text");
77 TEST("p7b", test_normalize
, "p7b", "application/pkcs7-certificates");
78 TEST("p7c", test_normalize
, "p7c", "application/pkcs7-mime");
79 TEST("p7f", test_normalize
, "p7f", "application/pkcs7-signature");
80 TEST("p7m", test_normalize
, "p7m", "application/pkcs7-mime");
81 TEST("p7s", test_normalize
, "p7s", "application/pkcs7-signature");
82 TEST("pdf", test_normalize
, "pdf", "application/pdf");
83 TEST("pk7", test_normalize
, "pk7", "application/pkcs7-mime");
84 TEST("png", test_normalize
, "png", "image/png");
85 TEST("ppt", test_normalize
, "ppt", "application/vnd.ms-powerpoint");
86 TEST("pptx", test_normalize
, "pptx",
87 "application/vnd.openxmlformats-officedocument.presentationml.presentation");
88 TEST("rtf", test_normalize
, "rtf", "application/rtf");
89 TEST("tif", test_normalize
, "tif", "image/tiff");
90 TEST("tiff", test_normalize
, "tiff", "image/tiff");
91 TEST("tsr", test_normalize
, "tsr", "application/timestamp-reply");
92 TEST("tst", test_normalize
, "tst", "application/timestamp-reply");
93 TEST("txt", test_normalize
, "txt", "text/plain");
94 TEST("wav", test_normalize
, "wav", "audio/wav");
95 TEST("xls", test_normalize
, "xls", "application/vnd.ms-excel");
96 TEST("xlsx", test_normalize
, "xlsx",
97 "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
98 TEST("xml", test_normalize
, "xml", "application/xml");
99 TEST("xsd", test_normalize
, "xsd", "application/xml");
100 TEST("zfo", test_normalize
, "zfo",
101 "application/vnd.software602.filler.form-xml-zip");