Back-ported the rsbetween from zebra 1.4
[idzebra-moved-to-github.git] / test / xpath / test6.sh
1 #!/bin/sh
2 # $Id: test6.sh,v 1.1.2.1 2004-12-16 19:11:41 heikki Exp $
3
4 pp=${srcdir:-"."}
5
6 LOG="test6.log"
7 TMP="test6.tmp"
8 #DBG="-v 1647"
9 DBG=""
10
11 rm -f $LOG
12 rm -f $TMP.*
13 ../../index/zebraidx -c $pp/zebra6.cfg -l $LOG init || exit 1
14 ../../index/zebraidx -c $pp/zebra6.cfg -l $LOG -t grs.xml update $pp/rec61.xml $pp/rec62.xml || exit 2
15 test -f dict*.mf || exit 1
16
17 ../../index/zebrasrv -c $pp/zebra6.cfg -l $LOG $DBG -S unix:socket & 
18 sleep 1
19 test -f zebrasrv.pid || exit 2
20
21 ../api/testclient unix:socket \
22             '@attr 5=1 @attr 6=3  @attr 4=1 @attr 1=/assembled/basic/names/CASno "367-93-1"' >$TMP.1
23
24 ../api/testclient unix:socket \
25             '@attr 5=1 @attr 6=3  @attr 4=1 @attr 1=18 "367-93-1"' >$TMP.2
26
27 ../api/testclient unix:socket '@attr 1=/assembled/orgs/org 0' >$TMP.3
28
29 ../api/testclient unix:socket '@and @attr 1=/assembled/orgs/org 0 @attr 5=1 @attr 6=3 @attr 4=1 @attr 1=/assembled/basic/names/CASno "367-93-1"' >$TMP.4
30
31 ../api/testclient unix:socket '@and @attr 1=/assembled/orgs/org 46 @attr 5=1 @attr 6=3  @attr 4=1 @attr 1=/assembled/basic/names/CASno 367-93-1' >$TMP.5
32
33 echo 'Killing server' >>$LOG
34 kill `cat zebrasrv.pid` || exit 3
35 sleep 1
36 echo "Result counts: " >> $LOG
37 cat $TMP.* >>$LOG
38 echo 'Checking that result 1 count is 2' >>$LOG
39 grep "^Result count: 2$" $TMP.1 >/dev/null || exit 4
40 echo 'Checking that result 2 count is 2' >>$LOG
41 grep "^Result count: 2$" $TMP.2 >/dev/null || exit 5
42 echo 'Checking that result 3 count is 1' >>$LOG
43 grep "^Result count: 1$" $TMP.3 >/dev/null || exit 6
44 echo 'Checking that result 4 count is 1' >>$LOG
45 grep "^Result count: 1$" $TMP.4 >/dev/null || exit 7
46 echo 'Checking that result 5 count is 2' >>$LOG
47 grep "^Result count: 2$" $TMP.5 >/dev/null || exit 8
48 echo 'Test OK' >>$LOG
49 exit 0
50