unit1394.c
Go to the documentation of this file.
00001 /***************************************************************************
00002  *                                  _   _ ____  _
00003  *  Project                     ___| | | |  _ \| |
00004  *                             / __| | | | |_) | |
00005  *                            | (__| |_| |  _ <| |___
00006  *                             \___|\___/|_| \_\_____|
00007  *
00008  * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
00009  *
00010  * This software is licensed as described in the file COPYING, which
00011  * you should have received as part of this distribution. The terms
00012  * are also available at https://curl.haxx.se/docs/copyright.html.
00013  *
00014  * You may opt to use, copy, modify, merge, publish, distribute and/or sell
00015  * copies of the Software, and permit persons to whom the Software is
00016  * furnished to do so, under the terms of the COPYING file.
00017  *
00018  * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
00019  * KIND, either express or implied.
00020  *
00021  ***************************************************************************/
00022 #include "curlcheck.h"
00023 
00024 #include "tool_getparam.h"
00025 
00026 #include <stdio.h>
00027 #include <stdlib.h>
00028 #include <string.h>
00029 
00030 #include "memdebug.h" /* LAST include file */
00031 
00032 static CURLcode unit_setup(void)
00033 {
00034   return CURLE_OK;
00035 }
00036 
00037 static void unit_stop(void)
00038 {
00039 
00040 }
00041 
00042 UNITTEST_START
00043 
00044   const char *values[] = {
00045     /* -E parameter */        /* exp. cert name */  /* exp. passphrase */
00046     "foo:bar:baz",            "foo",                "bar:baz",
00047     "foo\\:bar:baz",          "foo:bar",            "baz",
00048     "foo\\\\:bar:baz",        "foo\\",              "bar:baz",
00049     "foo:bar\\:baz",          "foo",                "bar\\:baz",
00050     "foo:bar\\\\:baz",        "foo",                "bar\\\\:baz",
00051     "foo\\bar\\baz",          "foo\\bar\\baz",      NULL,
00052     "foo\\\\bar\\\\baz",      "foo\\bar\\baz",      NULL,
00053     "foo\\",                  "foo\\",              NULL,
00054     "foo\\\\",                "foo\\",              NULL,
00055     "foo:bar\\",              "foo",                "bar\\",
00056     "foo:bar\\\\",            "foo",                "bar\\\\",
00057     "foo:bar:",               "foo",                "bar:",
00058     "foo\\::bar\\:",          "foo:",               "bar\\:",
00059 #ifdef WIN32
00060     "c:\\foo:bar:baz",        "c:\\foo",            "bar:baz",
00061     "c:\\foo\\:bar:baz",      "c:\\foo:bar",        "baz",
00062     "c:\\foo\\\\:bar:baz",    "c:\\foo\\",          "bar:baz",
00063     "c:\\foo:bar\\:baz",      "c:\\foo",            "bar\\:baz",
00064     "c:\\foo:bar\\\\:baz",    "c:\\foo",            "bar\\\\:baz",
00065     "c:\\foo\\bar\\baz",      "c:\\foo\\bar\\baz",  NULL,
00066     "c:\\foo\\\\bar\\\\baz",  "c:\\foo\\bar\\baz",  NULL,
00067     "c:\\foo\\",              "c:\\foo\\",          NULL,
00068     "c:\\foo\\\\",            "c:\\foo\\",          NULL,
00069     "c:\\foo:bar\\",          "c:\\foo",            "bar\\",
00070     "c:\\foo:bar\\\\",        "c:\\foo",            "bar\\\\",
00071     "c:\\foo:bar:",           "c:\\foo",            "bar:",
00072     "c:\\foo\\::bar\\:",      "c:\\foo:",           "bar\\:",
00073 #endif
00074     NULL,                     NULL,                 NULL,
00075   };
00076   const char **p;
00077   char *certname, *passphrase;
00078   for(p = values; *p; p += 3) {
00079     parse_cert_parameter(p[0], &certname, &passphrase);
00080     if(p[1]) {
00081       if(certname) {
00082         if(strcmp(p[1], certname)) {
00083           printf("expected certname '%s' but got '%s' "
00084               "for -E param '%s'\n", p[1], certname, p[0]);
00085           fail("assertion failure");
00086         }
00087       }
00088       else {
00089         printf("expected certname '%s' but got NULL "
00090             "for -E param '%s'\n", p[1], p[0]);
00091         fail("assertion failure");
00092       }
00093     }
00094     else {
00095       if(certname) {
00096         printf("expected certname NULL but got '%s' "
00097             "for -E param '%s'\n", certname, p[0]);
00098         fail("assertion failure");
00099       }
00100     }
00101     if(p[2]) {
00102       if(passphrase) {
00103         if(strcmp(p[2], passphrase)) {
00104           printf("expected passphrase '%s' but got '%s'"
00105               "for -E param '%s'\n", p[2], passphrase, p[0]);
00106           fail("assertion failure");
00107         }
00108       }
00109       else {
00110         printf("expected passphrase '%s' but got NULL "
00111             "for -E param '%s'\n", p[2], p[0]);
00112         fail("assertion failure");
00113       }
00114     }
00115     else {
00116       if(passphrase) {
00117         printf("expected passphrase NULL but got '%s' "
00118             "for -E param '%s'\n", passphrase, p[0]);
00119         fail("assertion failure");
00120       }
00121     }
00122     if(certname) free(certname);
00123     if(passphrase) free(passphrase);
00124   }
00125 
00126 UNITTEST_STOP


rc_visard_driver
Author(s): Heiko Hirschmueller , Christian Emmerich , Felix Ruess
autogenerated on Thu Jun 6 2019 20:43:07