]> rtime.felk.cvut.cz Git - hornmich/skoda-qr-demo.git/blob - QRScanner/mobile/jni/thirdparty/curl/tests/unit/unit1394.c
Add MuPDF native source codes
[hornmich/skoda-qr-demo.git] / QRScanner / mobile / jni / thirdparty / curl / tests / unit / unit1394.c
1 /***************************************************************************
2  *                                  _   _ ____  _
3  *  Project                     ___| | | |  _ \| |
4  *                             / __| | | | |_) | |
5  *                            | (__| |_| |  _ <| |___
6  *                             \___|\___/|_| \_\_____|
7  *
8  * Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al.
9  *
10  * This software is licensed as described in the file COPYING, which
11  * you should have received as part of this distribution. The terms
12  * are also available at http://curl.haxx.se/docs/copyright.html.
13  *
14  * You may opt to use, copy, modify, merge, publish, distribute and/or sell
15  * copies of the Software, and permit persons to whom the Software is
16  * furnished to do so, under the terms of the COPYING file.
17  *
18  * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
19  * KIND, either express or implied.
20  *
21  ***************************************************************************/
22 #include "curlcheck.h"
23
24 #include "tool_getparam.h"
25
26 #include <stdio.h>
27 #include <stdlib.h>
28 #include <string.h>
29
30 #include "curl_memory.h"
31 #include "memdebug.h" /* LAST include file */
32
33 static CURLcode unit_setup(void)
34 {
35   return CURLE_OK;
36 }
37
38 static void unit_stop(void)
39 {
40
41 }
42
43 UNITTEST_START
44
45   const char *values[] = {
46     /* -E parameter */        /* exp. cert name */  /* exp. passphrase */
47     "foo:bar:baz",            "foo",                "bar:baz",
48     "foo\\:bar:baz",          "foo:bar",            "baz",
49     "foo\\\\:bar:baz",        "foo\\",              "bar:baz",
50     "foo:bar\\:baz",          "foo",                "bar\\:baz",
51     "foo:bar\\\\:baz",        "foo",                "bar\\\\:baz",
52     "foo\\bar\\baz",          "foo\\bar\\baz",      NULL,
53     "foo\\\\bar\\\\baz",      "foo\\bar\\baz",      NULL,
54     "foo\\",                  "foo\\",              NULL,
55     "foo\\\\",                "foo\\",              NULL,
56     "foo:bar\\",              "foo",                "bar\\",
57     "foo:bar\\\\",            "foo",                "bar\\\\",
58     "foo:bar:",               "foo",                "bar:",
59     "foo\\::bar\\:",          "foo:",               "bar\\:",
60 #ifdef WIN32
61     "c:\\foo:bar:baz",        "c:\\foo",            "bar:baz",
62     "c:\\foo\\:bar:baz",      "c:\\foo:bar",        "baz",
63     "c:\\foo\\\\:bar:baz",    "c:\\foo\\",          "bar:baz",
64     "c:\\foo:bar\\:baz",      "c:\\foo",            "bar\\:baz",
65     "c:\\foo:bar\\\\:baz",    "c:\\foo",            "bar\\\\:baz",
66     "c:\\foo\\bar\\baz",      "c:\\foo\\bar\\baz",  NULL,
67     "c:\\foo\\\\bar\\\\baz",  "c:\\foo\\bar\\baz",  NULL,
68     "c:\\foo\\",              "c:\\foo\\",          NULL,
69     "c:\\foo\\\\",            "c:\\foo\\",          NULL,
70     "c:\\foo:bar\\",          "c:\\foo",            "bar\\",
71     "c:\\foo:bar\\\\",        "c:\\foo",            "bar\\\\",
72     "c:\\foo:bar:",           "c:\\foo",            "bar:",
73     "c:\\foo\\::bar\\:",      "c:\\foo:",           "bar\\:",
74 #endif
75     NULL,                     NULL,                 NULL,
76   };
77   const char **p;
78   char *certname, *passphrase;
79   for(p = values; *p; p += 3) {
80     parse_cert_parameter(p[0], &certname, &passphrase);
81     if(p[1]) {
82       if(certname) {
83         if(strcmp(p[1], certname)) {
84           printf("expected certname '%s' but got '%s' "
85               "for -E param '%s'\n", p[1], certname, p[0]);
86           fail("assertion failure");
87         }
88       } else {
89         printf("expected certname '%s' but got NULL "
90             "for -E param '%s'\n", p[1], p[0]);
91         fail("assertion failure");
92       }
93     } else {
94       if(certname) {
95         printf("expected certname NULL but got '%s' "
96             "for -E param '%s'\n", certname, p[0]);
97         fail("assertion failure");
98       }
99     }
100     if(p[2]) {
101       if(passphrase) {
102         if(strcmp(p[2], passphrase)) {
103           printf("expected passphrase '%s' but got '%s'"
104               "for -E param '%s'\n", p[2], passphrase, p[0]);
105           fail("assertion failure");
106         }
107       } else {
108         printf("expected passphrase '%s' but got NULL "
109             "for -E param '%s'\n", p[2], p[0]);
110         fail("assertion failure");
111       }
112     } else {
113       if(passphrase) {
114         printf("expected passphrase NULL but got '%s' "
115             "for -E param '%s'\n", passphrase, p[0]);
116         fail("assertion failure");
117       }
118     }
119     if(certname) free(certname);
120     if(passphrase) free(passphrase);
121   }
122
123 UNITTEST_STOP