Removed map_only arg from chrmaptab_create. Added skeleton for proper
[idzebra-moved-to-github.git] / util / tstcharmap.c
diff --git a/util/tstcharmap.c b/util/tstcharmap.c
new file mode 100644 (file)
index 0000000..edff882
--- /dev/null
@@ -0,0 +1,59 @@
+/* $Id: tstcharmap.c,v 1.1 2005-06-15 21:31:45 adam Exp $
+   Copyright (C) 1995-2005
+   Index Data ApS
+
+This file is part of the Zebra server.
+
+Zebra is free software; you can redistribute it and/or modify it under
+the terms of the GNU General Public License as published by the Free
+Software Foundation; either version 2, or (at your option) any later
+version.
+
+Zebra is distributed in the hope that it will be useful, but WITHOUT ANY
+WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Zebra; see the file LICENSE.zebra.  If not, write to the
+Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+02111-1307, USA.
+*/
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <assert.h>
+#include <charmap.h>
+
+void tst1()
+{
+    /* open existing map chrmaptab.chr */
+    chrmaptab tab = chrmaptab_create(0 /* tabpath */,
+                                    "tstcharmap.chr" /* file */,
+                                    0 /* tabroot */ );
+    assert(tab);
+    
+    chrmaptab_destroy(tab);
+}
+
+void tst2()
+{
+    /* open non-existing nonexist.chr */
+    chrmaptab tab = chrmaptab_create(0 /* tabpath */,
+                                    "nonexist.chr" /* file */,
+                                    0 /* tabroot */ );
+    assert(!tab);
+}
+
+int main(int argc, char **argv)
+{
+    char logname[2048];
+    sprintf(logname, "%s.log", argv[0]);
+    yaz_log_init_file(logname);
+
+    tst1();
+    tst2();
+
+    exit(0);
+}
+