From 710144c9d5a2577034d300ef6beb334d5145d657 Mon Sep 17 00:00:00 2001 From: Sebastian Hammer Date: Tue, 14 Sep 2004 14:35:52 +0000 Subject: [PATCH] Added Sort2 test suite to check prefix-ignoreing code --- test/Makefile.am | 2 +- test/sort2/Makefile.am | 10 +++++++++ test/sort2/default.idx | 55 +++++++++++++++++++++++++++++++++++++++++++++ test/sort2/my.abs | 14 ++++++++++++ test/sort2/rec1.xml | 3 +++ test/sort2/rec2.xml | 3 +++ test/sort2/rec3.xml | 3 +++ test/sort2/rec4.xml | 3 +++ test/sort2/sort.chr | 34 ++++++++++++++++++++++++++++ test/sort2/string-hat.chr | 44 ++++++++++++++++++++++++++++++++++++ test/sort2/test1.sh | 34 ++++++++++++++++++++++++++++ test/sort2/zebra.cfg | 14 ++++++++++++ 12 files changed, 218 insertions(+), 1 deletion(-) create mode 100644 test/sort2/Makefile.am create mode 100644 test/sort2/default.idx create mode 100644 test/sort2/my.abs create mode 100644 test/sort2/rec1.xml create mode 100644 test/sort2/rec2.xml create mode 100644 test/sort2/rec3.xml create mode 100644 test/sort2/rec4.xml create mode 100644 test/sort2/sort.chr create mode 100644 test/sort2/string-hat.chr create mode 100755 test/sort2/test1.sh create mode 100644 test/sort2/zebra.cfg diff --git a/test/Makefile.am b/test/Makefile.am index f61aaba..4682121 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -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 index 0000000..ffc4f6c --- /dev/null +++ b/test/sort2/Makefile.am @@ -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 index 0000000..ddfc9ec --- /dev/null +++ b/test/sort2/default.idx @@ -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 index 0000000..7c14393 --- /dev/null +++ b/test/sort2/my.abs @@ -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 index 0000000..6dbf26f --- /dev/null +++ b/test/sort2/rec1.xml @@ -0,0 +1,3 @@ + + first computer + diff --git a/test/sort2/rec2.xml b/test/sort2/rec2.xml new file mode 100644 index 0000000..23bb030 --- /dev/null +++ b/test/sort2/rec2.xml @@ -0,0 +1,3 @@ + + second computer + diff --git a/test/sort2/rec3.xml b/test/sort2/rec3.xml new file mode 100644 index 0000000..245c6e1 --- /dev/null +++ b/test/sort2/rec3.xml @@ -0,0 +1,3 @@ + + A third computer + diff --git a/test/sort2/rec4.xml b/test/sort2/rec4.xml new file mode 100644 index 0000000..8ed6c2c --- /dev/null +++ b/test/sort2/rec4.xml @@ -0,0 +1,3 @@ + + the fourth computer + diff --git a/test/sort2/sort.chr b/test/sort2/sort.chr new file mode 100644 index 0000000..b8b6878 --- /dev/null +++ b/test/sort2/sort.chr @@ -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 index 0000000..180843b --- /dev/null +++ b/test/sort2/string-hat.chr @@ -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 (ä) ä +#map (æ) æ +#map (ø) ø +#map (å) å +#map (ö) ö +#map (Ä) Ä +#map (&Aelig;) Æ +#map (Ø) Ø +#map (Å) Å +#map (Ö) Ö + +#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 index 0000000..805e0a1 --- /dev/null +++ b/test/sort2/test1.sh @@ -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 index 0000000..1ae545d --- /dev/null +++ b/test/sort2/zebra.cfg @@ -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 -- 1.7.10.4