ZOOM C: deal with excess bytes HTTPS case YAZ-833
[yaz-moved-to-github.git] / test / test_tpath.c
1 /* This file is part of the YAZ toolkit.
2  * Copyright (C) Index Data
3  * See the file LICENSE for details.
4  */
5 #include <yaz/tpath.h>
6 #include <yaz/test.h>
7 #include <string.h>
8 #include <yaz/log.h>
9
10 #if HAVE_CONFIG_H
11 #include <config.h>
12 #endif
13
14
15 static void tst_tpath(void)
16 {
17     char fullpath[FILENAME_MAX];
18
19     YAZ_CHECK(!yaz_filepath_resolve("etc", 0, 0, fullpath));
20     YAZ_CHECK(!yaz_filepath_resolve("etc", "", 0, fullpath)); /* bug #606 */
21     YAZ_CHECK(!yaz_filepath_resolve("etc", ".", 0, fullpath));
22     YAZ_CHECK(!yaz_filepath_resolve("does_not_exist", "", 0, fullpath));
23     YAZ_CHECK(!yaz_filepath_resolve("does_not_exist", ".", 0, fullpath));
24     YAZ_CHECK(yaz_filepath_resolve("test_tpath", 0, 0, fullpath));
25
26     YAZ_CHECK(yaz_filepath_resolve("test_tpath", "", 0, fullpath));
27     YAZ_CHECK(yaz_filepath_resolve("test_tpath", ".", 0, fullpath));
28
29     YAZ_CHECK(!yaz_filepath_resolve("test_tpath", "unknown_dir", 0, fullpath));
30     YAZ_CHECK(yaz_filepath_resolve("test_tpath", "unknown_dir:.", 0, fullpath));
31     YAZ_CHECK(!yaz_filepath_resolve("test_tpath", "unknown_dir:", 0, fullpath));
32     YAZ_CHECK(!yaz_filepath_resolve("test_tpath", "unknown_dir:c:", 0, fullpath));
33     YAZ_CHECK(!yaz_filepath_resolve("test_tpath", "unknown_dir:c:\\other", 0, fullpath));
34
35 }
36
37 int main(int argc, char **argv)
38 {
39     YAZ_CHECK_INIT(argc, argv);
40     tst_tpath();
41     YAZ_CHECK_TERM;
42 }
43
44 /*
45  * Local variables:
46  * c-basic-offset: 4
47  * c-file-style: "Stroustrup"
48  * indent-tabs-mode: nil
49  * End:
50  * vim: shiftwidth=4 tabstop=8 expandtab
51  */
52