From: Heikki Levanto Date: Mon, 9 Feb 2004 17:44:49 +0000 (+0000) Subject: Tests for rsbetween's fastforward function X-Git-Tag: ZEBRA.1.3.16~130 X-Git-Url: http://git.indexdata.com/?p=idzebra-moved-to-github.git;a=commitdiff_plain;h=dd54c64b5a89d7f4180e24463e5238eed6e3620b Tests for rsbetween's fastforward function --- diff --git a/test/xpath/Makefile.am b/test/xpath/Makefile.am index 194cd31..b8b1fb2 100644 --- a/test/xpath/Makefile.am +++ b/test/xpath/Makefile.am @@ -1,8 +1,8 @@ -# $Id: Makefile.am,v 1.5 2004-01-15 13:31:31 adam Exp $ +# $Id: Makefile.am,v 1.6 2004-02-09 17:44:49 heikki Exp $ -check_SCRIPTS = simple1.sh test1.sh test2.sh test3.sh test4.sh +check_SCRIPTS = simple1.sh test1.sh test2.sh test3.sh test4.sh test5.sh TESTS = $(check_SCRIPTS) -EXTRA_DIST = zebra.cfg rec.xml simple1.xml rec4.xml $(check_SCRIPTS) +EXTRA_DIST = zebra.cfg rec.xml simple1.xml rec4.xml rec5.xml $(check_SCRIPTS) diff --git a/test/xpath/rec5.xml b/test/xpath/rec5.xml new file mode 100644 index 0000000..57eea27 --- /dev/null +++ b/test/xpath/rec5.xml @@ -0,0 +1,26 @@ + + foo + bar + gryf + + + + foo bar + gryf + + + + foo gryf + grunt + + + + foo grunt + bar + + + + hamlet + foo bar grunt + + diff --git a/test/xpath/test5.sh b/test/xpath/test5.sh new file mode 100755 index 0000000..d193081 --- /dev/null +++ b/test/xpath/test5.sh @@ -0,0 +1,47 @@ +#!/bin/sh +# $Id: test5.sh,v 1.1 2004-02-09 17:44:49 heikki Exp $ +LOG="test5.log" +TMP="test5.tmp" +DBG="-v 1647" +rm -f $LOG +rm -f $TMP.* +../../index/zebraidx -l $LOG init || exit 1 +../../index/zebraidx -l $LOG -t grs.sgml update rec5.xml || exit 2 +test -f dict*.mf || exit 1 +../../index/zebrasrv -l $LOG $DBG -S unix:socket & +sleep 1 +test -f zebrasrv.pid || exit 2 +../api/testclient unix:socket '@attr 1=/record/title foo' >$TMP.1 +../api/testclient unix:socket '@attr 1=/record/title bar' >$TMP.2 +../api/testclient unix:socket "@attr {1=/record/title[@lang='da']} foo" >$TMP.3 +../api/testclient unix:socket "@attr {1=/record/title[@lang='en']} foo" >$TMP.4 +../api/testclient unix:socket "@attr 1=/record/title @and foo bar" >$TMP.5 +# The last one returns two hits, as the and applies to the whole +# record, so it matches foobar +# This might not have to be like that, but currently that is what +# zebra does. +../api/testclient unix:socket "@attr 1=/record/value bar" >$TMP.6 +../api/testclient unix:socket "@and @attr 1=/record/title foo @attr 1=/record/title grunt" >$TMP.7 + +echo 'Killing server' >>$LOG +kill `cat zebrasrv.pid` || exit 3 +sleep 1 +echo "Result counts: " >> $LOG +cat $TMP.* >>$LOG +echo 'Checking that result count is 4' >>$LOG +grep "^Result count: 4$" $TMP.1 >/dev/null || exit 4 +echo 'Checking that result count is 2' >>$LOG +grep "^Result count: 2$" $TMP.2 >/dev/null || exit 5 +echo 'Checking that result count is 1' >>$LOG +grep "^Result count: 1$" $TMP.3 >/dev/null || exit 6 +echo 'Checking that result count is 1' >>$LOG +grep "^Result count: 1$" $TMP.4 >/dev/null || exit 7 +echo 'Checking that result count is 2' >>$LOG +grep "^Result count: 2$" $TMP.5 >/dev/null || exit 8 +echo 'Checking that result count is 1' >>$LOG +grep "^Result count: 1$" $TMP.6 >/dev/null || exit 8 +echo 'Checking that result count is 1' >>$LOG +grep "^Result count: 1$" $TMP.7 >/dev/null || exit 8 +echo 'Test OK' >>$LOG +exit 0 + diff --git a/test/xpath/zebra.cfg b/test/xpath/zebra.cfg index 9f69b93..09281c4 100644 --- a/test/xpath/zebra.cfg +++ b/test/xpath/zebra.cfg @@ -1,8 +1,10 @@ -# $Id: zebra.cfg,v 1.2 2002-11-11 15:19:25 heikki Exp $ +# $Id: zebra.cfg,v 1.3 2004-02-09 17:44:49 heikki Exp $ profilePath: .:../../tab recordType: grs.sgml attset: bib1.att +isam:b +