From 34c9e6d1eb1fdb87872d35538106b15e613cdd3d Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Thu, 2 Dec 2004 13:59:08 +0000 Subject: [PATCH] charmap test using api --- test/charmap/Makefile.am | 29 +++++++++++++++++++++++----- test/charmap/charmap1.c | 48 ++++++++++++++++++++++++++++++++++++++++++++++ test/charmap/test1.sh | 20 ------------------- test/charmap/test2.sh | 21 -------------------- 4 files changed, 72 insertions(+), 46 deletions(-) create mode 100644 test/charmap/charmap1.c delete mode 100755 test/charmap/test1.sh delete mode 100755 test/charmap/test2.sh diff --git a/test/charmap/Makefile.am b/test/charmap/Makefile.am index 37b79de..f280c3d 100644 --- a/test/charmap/Makefile.am +++ b/test/charmap/Makefile.am @@ -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 index 0000000..1ef2269 --- /dev/null +++ b/test/charmap/charmap1.c @@ -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 index 2059b29..0000000 --- a/test/charmap/test1.sh +++ /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 index 31861c2..0000000 --- a/test/charmap/test2.sh +++ /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 -- 1.7.10.4