8abf0451e29dc0f9f03f4946fc44c4fe12101dcc
[yaz-moved-to-github.git] / test / tst_filepath.c
1 /* This file is part of the YAZ toolkit.
2  * Copyright (C) 1995-2010 Index Data
3  * See the file LICENSE for details.
4  */
5
6 #if HAVE_CONFIG_H
7 #include <config.h>
8 #endif
9
10 #include <errno.h>
11 #include <string.h>
12 #include <stdlib.h>
13 #include <ctype.h>
14
15 #include <yaz/tpath.h>
16 #include <yaz/test.h>
17
18 void tst(void)
19 {
20     char fullpath[1024];
21     YAZ_CHECK(yaz_filepath_resolve("tst_filepath", ".", 0, fullpath));
22     YAZ_CHECK(strcmp(fullpath, "./tst_filepath") == 0);
23     YAZ_CHECK(!yaz_filepath_resolve("tst_filepath1", ".", 0, fullpath));
24     YAZ_CHECK(!yaz_filepath_resolve("tst_filepath", "bogus", 0, fullpath));
25     YAZ_CHECK(yaz_filepath_resolve("tst_filepath", "bogus:.", 0, fullpath));
26 }
27
28 int main (int argc, char **argv)
29 {
30     YAZ_CHECK_INIT(argc, argv);
31     tst();
32     YAZ_CHECK_TERM;
33 }
34 /*
35  * Local variables:
36  * c-basic-offset: 4
37  * c-file-style: "Stroustrup"
38  * indent-tabs-mode: nil
39  * End:
40  * vim: shiftwidth=4 tabstop=8 expandtab
41  */
42