Added Sort2 test suite to check prefix-ignoreing code
authorSebastian Hammer <quinn@indexdata.com>
Tue, 14 Sep 2004 14:35:52 +0000 (14:35 +0000)
committerSebastian Hammer <quinn@indexdata.com>
Tue, 14 Sep 2004 14:35:52 +0000 (14:35 +0000)
12 files changed:
test/Makefile.am
test/sort2/Makefile.am [new file with mode: 0644]
test/sort2/default.idx [new file with mode: 0644]
test/sort2/my.abs [new file with mode: 0644]
test/sort2/rec1.xml [new file with mode: 0644]
test/sort2/rec2.xml [new file with mode: 0644]
test/sort2/rec3.xml [new file with mode: 0644]
test/sort2/rec4.xml [new file with mode: 0644]
test/sort2/sort.chr [new file with mode: 0644]
test/sort2/string-hat.chr [new file with mode: 0644]
test/sort2/test1.sh [new file with mode: 0755]
test/sort2/zebra.cfg [new file with mode: 0644]

index f61aaba..4682121 100644 (file)
@@ -1,4 +1,4 @@
 
-SUBDIRS=codec api gils malxml config usmarc dmoz xpath sort xelm cddb \
+SUBDIRS=codec api gils malxml config usmarc dmoz xpath sort sort2 xelm cddb \
  rusmarc zsh marcxml charmap
 
diff --git a/test/sort2/Makefile.am b/test/sort2/Makefile.am
new file mode 100644 (file)
index 0000000..ffc4f6c
--- /dev/null
@@ -0,0 +1,10 @@
+# $Id: Makefile.am,v 1.1 2004-09-14 14:35:52 quinn Exp $
+
+check_SCRIPTS = test1.sh
+
+TESTS = $(check_SCRIPTS)
+
+EXTRA_DIST = zebra.cfg default.idx string-hat.chr \
+ rec1.xml rec2.xml rec3.xml rec4.xml zebra.cfg my.abs sort.chr \
+ $(check_SCRIPTS)
+
diff --git a/test/sort2/default.idx b/test/sort2/default.idx
new file mode 100644 (file)
index 0000000..ddfc9ec
--- /dev/null
@@ -0,0 +1,55 @@
+# Zebra indexes as referred to from the *.abs-files.
+#  $Id: default.idx,v 1.1 2004-09-14 14:35:52 quinn Exp $
+#
+
+# Traditional word index
+# Used if completenss is 'incomplete field' (@attr 6=1) and
+# structure is word/phrase/word-list/free-form-text/document-text
+index w
+completeness 0
+position 1
+charmap sort.chr
+
+# Phrase index
+# Used if completeness is 'complete {sub}field' (@attr 6=2, @attr 6=1)
+# and structure is word/phrase/word-list/free-form-text/document-text
+index p
+completeness 1
+charmap sort.chr
+
+# URX (URL) index
+# Used if structure=urx (@attr 4=104)
+index u
+completeness 0
+charmap urx.chr
+
+# Numeric index
+# Used if structure=numeric (@attr 4=109)
+index n
+completeness 0
+charmap numeric.chr
+
+# Null map index (no mapping at all)
+# Used if structure=key (@attr 4=3)
+index 0
+completeness 0
+position 1
+charmap @
+
+# Year
+# Used if structure=year (@attr 4=4)
+index y
+completeness 0
+charmap @
+
+# Date
+# Used if structure=date (@attr 4=5)
+index d
+completeness 0
+charmap @
+
+# Sort, with prefixes to ignore
+sort s
+completeness 1
+charmap sort.chr
+
diff --git a/test/sort2/my.abs b/test/sort2/my.abs
new file mode 100644 (file)
index 0000000..7c14393
--- /dev/null
@@ -0,0 +1,14 @@
+# $Id: my.abs,v 1.1 2004-09-14 14:35:52 quinn Exp $
+
+name my
+reference WAIS-schema
+attset bib1.att
+tagset generic.tag
+xpath enable
+
+varset var1.var
+
+esetname B @
+esetname F @
+
+elm title              Title                   !:p,!:w,!:s
diff --git a/test/sort2/rec1.xml b/test/sort2/rec1.xml
new file mode 100644 (file)
index 0000000..6dbf26f
--- /dev/null
@@ -0,0 +1,3 @@
+<my>
+  <title>first computer</title>
+</my>
diff --git a/test/sort2/rec2.xml b/test/sort2/rec2.xml
new file mode 100644 (file)
index 0000000..23bb030
--- /dev/null
@@ -0,0 +1,3 @@
+<my>
+  <title>second computer</title>
+</my>
diff --git a/test/sort2/rec3.xml b/test/sort2/rec3.xml
new file mode 100644 (file)
index 0000000..245c6e1
--- /dev/null
@@ -0,0 +1,3 @@
+<my>
+  <title>A third computer</title>
+</my>
diff --git a/test/sort2/rec4.xml b/test/sort2/rec4.xml
new file mode 100644 (file)
index 0000000..8ed6c2c
--- /dev/null
@@ -0,0 +1,3 @@
+<my>
+  <title>the fourth computer</title>
+</my>
diff --git a/test/sort2/sort.chr b/test/sort2/sort.chr
new file mode 100644 (file)
index 0000000..b8b6878
--- /dev/null
@@ -0,0 +1,34 @@
+# Generic character map.
+#
+# $Id: sort.chr,v 1.1 2004-09-14 14:35:52 quinn Exp $
+
+# Define the basic value-set. *Beware* of changing this without re-indexing
+# your databases.
+
+lowercase {0-9}{a-y}üzæäøöå
+uppercase {0-9}{A-Y}ÜZÆÄØÖÅ
+
+# Breaking characters
+
+space {\001-\040}!"#$%&'\()*+,-./:;<=>?@\[\\]^_`\{|}~
+
+# Characters to be considered equivalent for searching purposes.
+
+# equivalent æä(ae)
+# equivalent øö(oe)
+# equivalent å(aa)
+# equivalent uü
+
+map (^The\s)   @
+map (^the\s)   @
+map (^a\s)      @
+map (^A\s)     @
+
+#map éÉ                e
+#map á         a
+#map ó         o
+#map í         i
+
+#map (Aa)      (AA)
+
+#map (aa)        a
diff --git a/test/sort2/string-hat.chr b/test/sort2/string-hat.chr
new file mode 100644 (file)
index 0000000..180843b
--- /dev/null
@@ -0,0 +1,44 @@
+# Generic character map but with ^ as cut char
+#
+# $Id: string-hat.chr,v 1.1 2004-09-14 14:35:52 quinn Exp $
+
+# Define the basic value-set. *Beware* of changing this without re-indexing
+# your databases.
+
+lowercase {0-9}{a-y}üzæäøöå
+uppercase {0-9}{A-Y}ÜZÆÄØÖÅ
+
+cut ^
+
+# Breaking characters
+
+space {\001-\040}!"#$%&'\()*+,-./:;<=>?@\[\\]_`\{|}~
+
+# Characters to be considered equivalent for searching purposes.
+
+# equivalent æä(ae)
+# equivalent øö(oe)
+# equivalent å(aa)
+# equivalent uü
+
+# Supplemental mappings
+
+#map (&auml;)       ä
+#map (&aelig;)      æ
+#map (&oslash;)     ø
+#map (&aring;)      å
+#map (&ouml;)       ö
+#map (&Auml;)       Ä
+#map (&Aelig;)      Æ
+#map (&Oslash;)     Ø
+#map (&Aring;)      Å
+#map (&Ouml;)       Ö
+
+#map éÉ                e
+#map á         a
+#map ó         o
+#map í         i
+
+#map (Aa)      (AA)
+
+#map (aa)        a
diff --git a/test/sort2/test1.sh b/test/sort2/test1.sh
new file mode 100755 (executable)
index 0000000..805e0a1
--- /dev/null
@@ -0,0 +1,34 @@
+#!/bin/sh
+# $Id: test1.sh,v 1.1 2004-09-14 14:35:52 quinn Exp $
+
+pp=${srcdir:-"."}
+
+ulimit -c 10000
+LOG=test1.log
+rm -f $LOG
+rm -fr lock
+mkdir lock
+rm -fr reg
+mkdir reg
+rm -fr recs
+mkdir recs
+cp $pp/rec*.xml recs
+../../index/zebraidx -c $pp/zebra.cfg -l $LOG update recs || exit 1
+../../index/zebrasrv -c $pp/zebra.cfg -l $LOG unix:socket &
+sleep 1
+test -f lock/zebrasrv.pid || exit 2
+../api/testclient -n4 unix:socket '@or computer @attr 7=1 @attr 1=4 0' >tmp1
+
+kill `cat lock/zebrasrv.pid`
+
+echo 'Result count: 4
+my:
+  title: first computer
+my:
+  title: the fourth computer
+my:
+  title: second computer
+my:
+  title: A third computer' >tmp2
+
+diff tmp1 tmp2
diff --git a/test/sort2/zebra.cfg b/test/sort2/zebra.cfg
new file mode 100644 (file)
index 0000000..1ae545d
--- /dev/null
@@ -0,0 +1,14 @@
+# Simple Zebra configuration file
+# $Id: zebra.cfg,v 1.1 2004-09-14 14:35:52 quinn Exp $
+#
+# Where the schema files, attribute files, etc are located.
+profilePath: ${srcdir:-.}:${srcdir:-.}/../../tab
+
+# Files that describe the attribute sets supported.
+attset: bib1.att
+attset: explain.att
+
+recordtype.xml: grs.sgml
+lockdir: lock
+register: reg:20M
+isam: b