TODO: OTP-authenticatd password change tested
[libisds.git] / test / offline / normalize_mime_type.c
blobc9090f752b29998e2cc742c9e064df631b46e8cf
1 #include "../test.h"
2 #include "crypto.h"
3 #include <string.h>
6 static int test_normalize(const char *input, const char *expected) {
7 const char *output = isds_normalize_mime_type(input);
9 if (!expected) {
10 if (!output) {
11 PASS_TEST;
12 } else {
13 FAIL_TEST("isds_normalize_mime_type(%s) returned=%s, expected=%s",
14 input, output, expected);
16 } else if (!output) {
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);
26 PASS_TEST;
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");
36 TEST("cer", test_normalize, "cer", "application/x-x509-ca-cert");
37 TEST("crt", test_normalize, "crt", "application/x-x509-ca-cert");
38 TEST("der", test_normalize, "der", "application/x-x509-ca-cert");
39 TEST("doc", test_normalize, "doc", "application/msword");
40 TEST("docx", test_normalize, "docx",
41 "application/vnd.openxmlformats-officedocument.wordprocessingml.document");
42 TEST("dbf", test_normalize, "dbf", "application/octet-stream")
43 TEST("prj", test_normalize, "prj", "application/octet-stream")
44 TEST("qix", test_normalize, "qix", "application/octet-stream")
45 TEST("sbx", test_normalize, "sbx", "application/octet-stream")
46 TEST("shp", test_normalize, "shp", "application/octet-stream")
47 TEST("shx", test_normalize, "shx", "application/octet-stream")
48 TEST("dgn", test_normalize, "dgn", "application/octet-stream")
49 TEST("dwg", test_normalize, "dwg", "image/vnd.dwg")
50 TEST("edi", test_normalize, "edi", "application/edifact")
51 TEST("fo", test_normalize, "fo",
52 "application/vnd.software602.filler.form+xml");
53 TEST("gfs", test_normalize, "gfs", "application/xml")
54 TEST("gml", test_normalize, "gml", "application/xml")
55 TEST("gif", test_normalize, "gif", "image/gif");
56 TEST("htm", test_normalize, "htm", "text/html");
57 TEST("html", test_normalize, "html", "text/html");
58 TEST("isdoc", test_normalize, "isdoc", "text/isdoc");
59 TEST("isdocx", test_normalize, "isdocx", "text/isdocx");
60 TEST("jfif", test_normalize, "jfif", "image/jpeg");
61 TEST("jpeg", test_normalize, "jpeg", "image/jpeg");
62 TEST("jpg", test_normalize, "jpg", "image/jpeg");
63 TEST("mpeg", test_normalize, "mpeg", "video/mpeg");
64 TEST("mpeg1", test_normalize, "mpeg1", "video/mpeg");
65 TEST("mpeg2", test_normalize, "mpeg2", "video/mpeg");
66 TEST("mpg", test_normalize, "mpg", "video/mpeg");
67 TEST("mp2", test_normalize, "mp2", "audio/mpeg");
68 TEST("mp3", test_normalize, "mp3", "audio/mpeg");
69 TEST("odp", test_normalize, "odp",
70 "application/vnd.oasis.opendocument.presentation");
71 TEST("ods", test_normalize, "ods",
72 "application/vnd.oasis.opendocument.spreadsheet");
73 TEST("odt", test_normalize, "odt",
74 "application/vnd.oasis.opendocument.text");
75 TEST("p7b", test_normalize, "p7b", "application/pkcs7-certificates");
76 TEST("p7c", test_normalize, "p7c", "application/pkcs7-mime");
77 TEST("p7f", test_normalize, "p7f", "application/pkcs7-signature");
78 TEST("p7m", test_normalize, "p7m", "application/pkcs7-mime");
79 TEST("p7s", test_normalize, "p7s", "application/pkcs7-signature");
80 TEST("pdf", test_normalize, "pdf", "application/pdf");
81 TEST("pk7", test_normalize, "pk7", "application/pkcs7-mime");
82 TEST("png", test_normalize, "png", "image/png");
83 TEST("ppt", test_normalize, "ppt", "application/vnd.ms-powerpoint");
84 TEST("pptx", test_normalize, "pptx",
85 "application/vnd.openxmlformats-officedocument.presentationml.presentation");
86 TEST("rtf", test_normalize, "rtf", "application/rtf");
87 TEST("tif", test_normalize, "tif", "image/tiff");
88 TEST("tiff", test_normalize, "tiff", "image/tiff");
89 TEST("tsr", test_normalize, "tsr", "application/timestamp-reply");
90 TEST("tst", test_normalize, "tst", "application/timestamp-reply");
91 TEST("txt", test_normalize, "txt", "text/plain");
92 TEST("wav", test_normalize, "wav", "audio/wav");
93 TEST("xls", test_normalize, "xls", "application/vnd.ms-excel");
94 TEST("xlsx", test_normalize, "xlsx",
95 "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
96 TEST("xml", test_normalize, "xml", "application/xml");
97 TEST("xsd", test_normalize, "xsd", "application/xml");
98 TEST("zfo", test_normalize, "zfo",
99 "application/vnd.software602.filler.form-xml-zip");
101 SUM_TEST();