Rename C-based tests
[yaz-moved-to-github.git] / test / test_filepath.c
diff --git a/test/test_filepath.c b/test/test_filepath.c
new file mode 100644 (file)
index 0000000..b06bb3d
--- /dev/null
@@ -0,0 +1,42 @@
+/* This file is part of the YAZ toolkit.
+ * Copyright (C) 1995-2010 Index Data
+ * See the file LICENSE for details.
+ */
+
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <errno.h>
+#include <string.h>
+#include <stdlib.h>
+#include <ctype.h>
+
+#include <yaz/tpath.h>
+#include <yaz/test.h>
+
+void tst(void)
+{
+    char fullpath[1024];
+    YAZ_CHECK(yaz_filepath_resolve("test_filepath", ".", 0, fullpath));
+    YAZ_CHECK(strcmp(fullpath, "./test_filepath") == 0);
+    YAZ_CHECK(!yaz_filepath_resolve("test_filepath1", ".", 0, fullpath));
+    YAZ_CHECK(!yaz_filepath_resolve("test_filepath", "bogus", 0, fullpath));
+    YAZ_CHECK(yaz_filepath_resolve("test_filepath", "bogus:.", 0, fullpath));
+}
+
+int main (int argc, char **argv)
+{
+    YAZ_CHECK_INIT(argc, argv);
+    tst();
+    YAZ_CHECK_TERM;
+}
+/*
+ * Local variables:
+ * c-basic-offset: 4
+ * c-file-style: "Stroustrup"
+ * indent-tabs-mode: nil
+ * End:
+ * vim: shiftwidth=4 tabstop=8 expandtab
+ */
+