charmap test using api
authorAdam Dickmeiss <adam@indexdata.dk>
Thu, 2 Dec 2004 13:59:08 +0000 (13:59 +0000)
committerAdam Dickmeiss <adam@indexdata.dk>
Thu, 2 Dec 2004 13:59:08 +0000 (13:59 +0000)
test/charmap/Makefile.am
test/charmap/charmap1.c [new file with mode: 0644]
test/charmap/test1.sh [deleted file]
test/charmap/test2.sh [deleted file]

index 37b79de..f280c3d 100644 (file)
@@ -1,9 +1,28 @@
-# $Id: Makefile.am,v 1.1 2004-03-09 15:12:15 adam Exp $
+# $Id: Makefile.am,v 1.2 2004-12-02 13:59:08 adam Exp $
 
-check_SCRIPTS = test1.sh test2.sh
+check_PROGRAMS = charmap1
 
-TESTS = $(check_SCRIPTS)
+TESTS = $(check_PROGRAMS)
+
+EXTRA_DIST = zebra.cfg x.xml default.idx string.utf8.chr
+
+charmap1_SOURCES = charmap1.c
+
+AM_CPPFLAGS = -I$(top_srcdir)/include $(YAZINC)
+
+zebralibs = \
+ ../../index/libidzebra-api.la \
+ ../../rset/libidzebra-rset.la \
+ ../../recctrl/libidzebra-recctrl.la \
+ ../../dict/libidzebra-dict.la  \
+ ../../isams/libidzebra-isams.la \
+ ../../isamc/libidzebra-isamc.la \
+ ../../isamb/libidzebra-isamb.la \
+ ../../data1/libidzebra-data1.la \
+ ../../bfile/libidzebra-bfile.la \
+ ../../dfa/libidzebra-dfa.la \
+ ../../util/libidzebra-util.la
+
+LDADD = ../api/libtestlib.a $(zebralibs) $(YAZLALIB)
 
-EXTRA_DIST = zebra.cfg x.xml default.idx string.utf8.chr \
- $(check_SCRIPTS)
 
diff --git a/test/charmap/charmap1.c b/test/charmap/charmap1.c
new file mode 100644 (file)
index 0000000..1ef2269
--- /dev/null
@@ -0,0 +1,48 @@
+/* $Id: charmap1.c,v 1.1 2004-12-02 13:59:08 adam Exp $
+   Copyright (C) 2003,2004
+   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 "../api/testlib.h"
+
+int main(int argc, char **argv)
+{
+    ZebraService zs = start_up(0, argc, argv);
+    ZebraHandle  zh = zebra_open(zs);
+    char path[256];
+
+    zebra_select_database(zh, "Default");
+
+    zebra_init(zh);
+
+    zebra_begin_trans(zh, 1);
+    sprintf(path, "%.200s/x.xml", get_srcdir());
+    zebra_repository_update(zh, path);
+    zebra_end_trans(zh);
+    zebra_commit(zh);
+
+    do_query(__LINE__, zh, "@term string æ", 1);
+
+    /* search for UNICODE 1E25 - letter h with dot below */
+    do_query(__LINE__, zh, "@term string ḥ", 1);
+
+
+    return close_down(zh, zs, 0);
+}
diff --git a/test/charmap/test1.sh b/test/charmap/test1.sh
deleted file mode 100755 (executable)
index 2059b29..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-#!/bin/sh
-# $Id: test1.sh,v 1.5 2004-09-27 11:22:39 adam Exp $
-
-pp=${srcdir:-"."}
-
-LOG=test1.log
-rm -f $LOG
-if ../../index/zebraidx -c $pp/zebra.cfg -l $LOG filters|grep grs.xml >/dev/null; then
-       ../../index/zebraidx -c $pp/zebra.cfg -l$LOG init
-else
-       exit 0
-fi
-../../index/zebraidx -c $pp/zebra.cfg -l$LOG update $pp/*.xml
-../../index/zebrasrv -c $pp/zebra.cfg -l$LOG unix:socket &
-sleep 2
-../api/testclient unix:socket '@term string æ' >tmp1
-echo 'Result count: 1' >tmp2
-kill `cat zebrasrv.pid` || exit 1
-diff tmp1 tmp2 || exit 2
-rm -f tmp1 tmp2
diff --git a/test/charmap/test2.sh b/test/charmap/test2.sh
deleted file mode 100755 (executable)
index 31861c2..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-#!/bin/sh
-# $id$
-
-pp=${srcdir:-"."}
-
-LOG=test2.log
-rm -f $LOG
-if ../../index/zebraidx -c $pp/zebra.cfg -l $LOG filters|grep grs.xml >/dev/null; then
-       ../../index/zebraidx -c $pp/zebra.cfg -l$LOG init
-else
-       exit 0
-fi
-../../index/zebraidx -c $pp/zebra.cfg -l$LOG update $pp/*.xml
-../../index/zebrasrv -c $pp/zebra.cfg -l$LOG unix:socket &
-sleep 2
-# search for UNICODE 1E25 - letter h with dot below
-../api/testclient unix:socket '@term string ḥ' >tmp1
-echo 'Result count: 1' >tmp2
-kill `cat zebrasrv.pid` || exit 1
-diff tmp1 tmp2 || exit 2
-rm -f tmp1 tmp2