From 1922579d92e1a9559d4c3ab4f1cf461f56c83c3b Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Wed, 16 Apr 2008 10:53:41 +0200 Subject: [PATCH] Renamed files for sort tests. --- test/sort/.gitignore | 2 +- test/sort/Makefile.am | 8 ++--- test/sort/default.idx | 58 ------------------------------- test/sort/my.abs | 14 -------- test/sort/rec1.xml | 5 --- test/sort/rec2.xml | 5 --- test/sort/rec3.xml | 5 --- test/sort/rec4.xml | 5 --- test/sort/sort1.abs | 14 ++++++++ test/sort/sort1.c | 76 ----------------------------------------- test/sort/string-hat.chr | 43 ----------------------- test/sort/test_sort1.c | 72 ++++++++++++++++++++++++++++++++++++++ test/sort/test_sort1.cfg | 13 +++++++ test/sort/test_sort1.chr | 43 +++++++++++++++++++++++ test/sort/test_sort1.idx | 58 +++++++++++++++++++++++++++++++ test/sort/test_sort1_rec.xml | 20 +++++++++++ test/sort/zebra.cfg | 11 ------ test/sort2/.gitignore | 2 +- test/sort2/Makefile.am | 8 ++--- test/sort2/default.idx | 54 ----------------------------- test/sort2/my.abs | 13 ------- test/sort2/rec1.xml | 3 -- test/sort2/rec2.xml | 3 -- test/sort2/rec3.xml | 3 -- test/sort2/rec4.xml | 3 -- test/sort2/sort.chr | 33 ------------------ test/sort2/sort2.abs | 13 +++++++ test/sort2/t1.c | 60 -------------------------------- test/sort2/test_sort2.c | 57 +++++++++++++++++++++++++++++++ test/sort2/test_sort2.cfg | 13 +++++++ test/sort2/test_sort2.chr | 33 ++++++++++++++++++ test/sort2/test_sort2.idx | 54 +++++++++++++++++++++++++++++ test/sort2/test_sort2_rec.xml | 12 +++++++ test/sort2/zebra.cfg | 11 ------ 34 files changed, 412 insertions(+), 415 deletions(-) delete mode 100644 test/sort/default.idx delete mode 100644 test/sort/my.abs delete mode 100644 test/sort/rec1.xml delete mode 100644 test/sort/rec2.xml delete mode 100644 test/sort/rec3.xml delete mode 100644 test/sort/rec4.xml create mode 100644 test/sort/sort1.abs delete mode 100644 test/sort/sort1.c delete mode 100644 test/sort/string-hat.chr create mode 100644 test/sort/test_sort1.c create mode 100644 test/sort/test_sort1.cfg create mode 100644 test/sort/test_sort1.chr create mode 100644 test/sort/test_sort1.idx create mode 100644 test/sort/test_sort1_rec.xml delete mode 100644 test/sort/zebra.cfg delete mode 100644 test/sort2/default.idx delete mode 100644 test/sort2/my.abs delete mode 100644 test/sort2/rec1.xml delete mode 100644 test/sort2/rec2.xml delete mode 100644 test/sort2/rec3.xml delete mode 100644 test/sort2/rec4.xml delete mode 100644 test/sort2/sort.chr create mode 100644 test/sort2/sort2.abs delete mode 100644 test/sort2/t1.c create mode 100644 test/sort2/test_sort2.c create mode 100644 test/sort2/test_sort2.cfg create mode 100644 test/sort2/test_sort2.chr create mode 100644 test/sort2/test_sort2.idx create mode 100644 test/sort2/test_sort2_rec.xml delete mode 100644 test/sort2/zebra.cfg diff --git a/test/sort/.gitignore b/test/sort/.gitignore index 538f201..55ebcd9 100644 --- a/test/sort/.gitignore +++ b/test/sort/.gitignore @@ -7,7 +7,7 @@ tmp? *.log .libs .deps -sort1 +test_sort1 *.lo *.o *~ diff --git a/test/sort/Makefile.am b/test/sort/Makefile.am index 3e89ac8..22e646d 100644 --- a/test/sort/Makefile.am +++ b/test/sort/Makefile.am @@ -1,12 +1,12 @@ -check_PROGRAMS = sort1 +check_PROGRAMS = test_sort1 TESTS = $(check_PROGRAMS) -EXTRA_DIST = zebra.cfg default.idx string-hat.chr \ - rec1.xml rec2.xml rec3.xml rec4.xml zebra.cfg my.abs +EXTRA_DIST = test_sort1.cfg test_sort1.idx test_sort1.chr \ + test_sort1_rec.xml sort1.abs -sort1_SOURCES = sort1.c +test_sort1_SOURCES = test_sort1.c AM_CPPFLAGS = -I$(top_srcdir)/include $(YAZINC) diff --git a/test/sort/default.idx b/test/sort/default.idx deleted file mode 100644 index cb94a8c..0000000 --- a/test/sort/default.idx +++ /dev/null @@ -1,58 +0,0 @@ -# Zebra indexes as referred to from the *.abs-files. -# - -# 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 string.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 string.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 register as usual but specify another map : string-hat. -sort s -completeness 1 -charmap string-hat.chr - -# Sort register with no map -sort S -completeness 1 -charmap string.chr diff --git a/test/sort/my.abs b/test/sort/my.abs deleted file mode 100644 index 27e6237..0000000 --- a/test/sort/my.abs +++ /dev/null @@ -1,14 +0,0 @@ - -name my -reference WAIS-schema -attset bib1.att -tagset generic.tag - -varset var1.var - -esetname B @ -esetname F @ - -elm (2,1) Title !:p,!:w -elm (2,8) Date !:s -elm (2,26) Cost Bib-level:S diff --git a/test/sort/rec1.xml b/test/sort/rec1.xml deleted file mode 100644 index c167bf5..0000000 --- a/test/sort/rec1.xml +++ /dev/null @@ -1,5 +0,0 @@ - - first computer - 2 - 2 - diff --git a/test/sort/rec2.xml b/test/sort/rec2.xml deleted file mode 100644 index d512f84..0000000 --- a/test/sort/rec2.xml +++ /dev/null @@ -1,5 +0,0 @@ - - second computer - 1 - 21 - diff --git a/test/sort/rec3.xml b/test/sort/rec3.xml deleted file mode 100644 index 41d7b95..0000000 --- a/test/sort/rec3.xml +++ /dev/null @@ -1,5 +0,0 @@ - - 3rd computer - a^3 - 15 - diff --git a/test/sort/rec4.xml b/test/sort/rec4.xml deleted file mode 100644 index b0ddd9f..0000000 --- a/test/sort/rec4.xml +++ /dev/null @@ -1,5 +0,0 @@ - - fourth computer - 4 - 11 - diff --git a/test/sort/sort1.abs b/test/sort/sort1.abs new file mode 100644 index 0000000..27e6237 --- /dev/null +++ b/test/sort/sort1.abs @@ -0,0 +1,14 @@ + +name my +reference WAIS-schema +attset bib1.att +tagset generic.tag + +varset var1.var + +esetname B @ +esetname F @ + +elm (2,1) Title !:p,!:w +elm (2,8) Date !:s +elm (2,26) Cost Bib-level:S diff --git a/test/sort/sort1.c b/test/sort/sort1.c deleted file mode 100644 index 435a22d..0000000 --- a/test/sort/sort1.c +++ /dev/null @@ -1,76 +0,0 @@ -/* This file is part of the Zebra server. - Copyright (C) 1995-2008 Index Data - -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 this program; if not, write to the Free Software -Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - -*/ - -#include "../api/testlib.h" - -static void tst(int argc, char **argv) -{ - ZebraService zs = tl_start_up(0, argc, argv); - ZebraHandle zh = zebra_open(zs, 0); - zint ids[5]; - char path[256]; - int i; - - YAZ_CHECK_EQ(zebra_select_database(zh, "Default"), ZEBRA_OK); - - zebra_init(zh); - - YAZ_CHECK(zebra_begin_trans(zh, 1) == ZEBRA_OK); - for (i = 1; i <= 4; i++) - { - sprintf(path, "%.200s/rec%d.xml", tl_get_srcdir(), i); - zebra_repository_update(zh, path); - } - YAZ_CHECK(zebra_end_trans(zh) == ZEBRA_OK); - zebra_commit(zh); - - ids[0] = 3; - ids[1] = 2; - ids[2] = 4; - ids[3] = 5; - YAZ_CHECK(tl_sort(zh, "@or @attr 1=4 computer @attr 7=1 @attr 1=30 0", 4, ids)); - YAZ_CHECK(tl_sort(zh, "@or @attr 1=4 computer @attr 7=1 @attr 1=Date 0", 4, ids)); - - ids[0] = 5; - ids[1] = 4; - ids[2] = 2; - ids[3] = 3; - YAZ_CHECK(tl_sort(zh, "@or @attr 1=4 computer @attr 7=1 @attr 1=1021 0", 4, ids)); - YAZ_CHECK(tl_sort(zh, "@or @attr 1=4 computer @attr 7=1 @attr 1=Bib-Level 0", 4, ids)); - - ids[0] = 2; - ids[1] = 5; - ids[2] = 4; - ids[3] = 3; - YAZ_CHECK(tl_sort(zh, "@or @attr 1=4 computer @attr 7=1 @attr 1=1021 @attr 4=109 0", 4, ids)); - YAZ_CHECK(tl_sort(zh, "@or @attr 1=4 computer @attr 7=1 @attr 1=Bib-Level @attr 4=109 0", 4, ids)); - - YAZ_CHECK(tl_close_down(zh, zs)); -} - - -TL_MAIN -/* - * Local variables: - * c-basic-offset: 4 - * indent-tabs-mode: nil - * End: - * vim: shiftwidth=4 tabstop=8 expandtab - */ - diff --git a/test/sort/string-hat.chr b/test/sort/string-hat.chr deleted file mode 100644 index 8353e8f..0000000 --- a/test/sort/string-hat.chr +++ /dev/null @@ -1,43 +0,0 @@ -# Generic character map but with ^ as cut char -# - -# 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/sort/test_sort1.c b/test/sort/test_sort1.c new file mode 100644 index 0000000..4fdf308 --- /dev/null +++ b/test/sort/test_sort1.c @@ -0,0 +1,72 @@ +/* This file is part of the Zebra server. + Copyright (C) 1995-2008 Index Data + +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 this program; if not, write to the Free Software +Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +*/ + +#include "../api/testlib.h" + +static void tst(int argc, char **argv) +{ + ZebraService zs = tl_start_up("test_sort1.cfg", argc, argv); + ZebraHandle zh = zebra_open(zs, 0); + zint ids[5]; + char path[256]; + + YAZ_CHECK_EQ(zebra_select_database(zh, "Default"), ZEBRA_OK); + + zebra_init(zh); + + YAZ_CHECK(zebra_begin_trans(zh, 1) == ZEBRA_OK); + sprintf(path, "%.200s/test_sort1_rec.xml", tl_get_srcdir()); + zebra_repository_update(zh, path); + YAZ_CHECK(zebra_end_trans(zh) == ZEBRA_OK); + zebra_commit(zh); + + ids[0] = 3; + ids[1] = 2; + ids[2] = 4; + ids[3] = 5; + YAZ_CHECK(tl_sort(zh, "@or @attr 1=4 computer @attr 7=1 @attr 1=30 0", 4, ids)); + YAZ_CHECK(tl_sort(zh, "@or @attr 1=4 computer @attr 7=1 @attr 1=Date 0", 4, ids)); + + ids[0] = 5; + ids[1] = 4; + ids[2] = 2; + ids[3] = 3; + YAZ_CHECK(tl_sort(zh, "@or @attr 1=4 computer @attr 7=1 @attr 1=1021 0", 4, ids)); + YAZ_CHECK(tl_sort(zh, "@or @attr 1=4 computer @attr 7=1 @attr 1=Bib-Level 0", 4, ids)); + + ids[0] = 2; + ids[1] = 5; + ids[2] = 4; + ids[3] = 3; + YAZ_CHECK(tl_sort(zh, "@or @attr 1=4 computer @attr 7=1 @attr 1=1021 @attr 4=109 0", 4, ids)); + YAZ_CHECK(tl_sort(zh, "@or @attr 1=4 computer @attr 7=1 @attr 1=Bib-Level @attr 4=109 0", 4, ids)); + + YAZ_CHECK(tl_close_down(zh, zs)); +} + + +TL_MAIN +/* + * Local variables: + * c-basic-offset: 4 + * indent-tabs-mode: nil + * End: + * vim: shiftwidth=4 tabstop=8 expandtab + */ + diff --git a/test/sort/test_sort1.cfg b/test/sort/test_sort1.cfg new file mode 100644 index 0000000..e050994 --- /dev/null +++ b/test/sort/test_sort1.cfg @@ -0,0 +1,13 @@ +# Simple Zebra configuration file +# +# 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 +isam: b + +index: test_sort1.idx diff --git a/test/sort/test_sort1.chr b/test/sort/test_sort1.chr new file mode 100644 index 0000000..8353e8f --- /dev/null +++ b/test/sort/test_sort1.chr @@ -0,0 +1,43 @@ +# Generic character map but with ^ as cut char +# + +# 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/sort/test_sort1.idx b/test/sort/test_sort1.idx new file mode 100644 index 0000000..d77ea50 --- /dev/null +++ b/test/sort/test_sort1.idx @@ -0,0 +1,58 @@ +# Zebra indexes as referred to from the *.abs-files. +# + +# 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 string.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 string.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 register as usual but specify another map : string-hat. +sort s +completeness 1 +charmap test_sort1.chr + +# Sort register with no map +sort S +completeness 1 +charmap string.chr diff --git a/test/sort/test_sort1_rec.xml b/test/sort/test_sort1_rec.xml new file mode 100644 index 0000000..4b215b4 --- /dev/null +++ b/test/sort/test_sort1_rec.xml @@ -0,0 +1,20 @@ + + first computer + 2 + 2 + + + second computer + 1 + 21 + + + 3rd computer + a^3 + 15 + + + fourth computer + 4 + 11 + diff --git a/test/sort/zebra.cfg b/test/sort/zebra.cfg deleted file mode 100644 index 0cfe09a..0000000 --- a/test/sort/zebra.cfg +++ /dev/null @@ -1,11 +0,0 @@ -# Simple Zebra configuration file -# -# 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 -isam: b diff --git a/test/sort2/.gitignore b/test/sort2/.gitignore index b62627b..45d6808 100644 --- a/test/sort2/.gitignore +++ b/test/sort2/.gitignore @@ -7,7 +7,7 @@ tmp? *.log .libs .deps -t[0-9] +test_sort2 *.lo *.o *~ diff --git a/test/sort2/Makefile.am b/test/sort2/Makefile.am index 440db3e..dcf6e68 100644 --- a/test/sort2/Makefile.am +++ b/test/sort2/Makefile.am @@ -1,12 +1,12 @@ -check_PROGRAMS = t1 +check_PROGRAMS = test_sort2 TESTS = $(check_PROGRAMS) -EXTRA_DIST = zebra.cfg default.idx \ - rec1.xml rec2.xml rec3.xml rec4.xml zebra.cfg my.abs sort.chr +EXTRA_DIST = test_sort2.cfg test_sort2.idx \ + test_sort2_rec.xml test_sort2.cfg sort2.abs test_sort2.chr -t1_SOURCES = t1.c +test_sort2_SOURCES = test_sort2.c AM_CPPFLAGS = -I$(top_srcdir)/include $(YAZINC) diff --git a/test/sort2/default.idx b/test/sort2/default.idx deleted file mode 100644 index 1da30ba..0000000 --- a/test/sort2/default.idx +++ /dev/null @@ -1,54 +0,0 @@ -# Zebra indexes as referred to from the *.abs-files. -# - -# 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 deleted file mode 100644 index 0c9f8a0..0000000 --- a/test/sort2/my.abs +++ /dev/null @@ -1,13 +0,0 @@ - -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 deleted file mode 100644 index 6dbf26f..0000000 --- a/test/sort2/rec1.xml +++ /dev/null @@ -1,3 +0,0 @@ - - first computer - diff --git a/test/sort2/rec2.xml b/test/sort2/rec2.xml deleted file mode 100644 index 23bb030..0000000 --- a/test/sort2/rec2.xml +++ /dev/null @@ -1,3 +0,0 @@ - - second computer - diff --git a/test/sort2/rec3.xml b/test/sort2/rec3.xml deleted file mode 100644 index 245c6e1..0000000 --- a/test/sort2/rec3.xml +++ /dev/null @@ -1,3 +0,0 @@ - - A third computer - diff --git a/test/sort2/rec4.xml b/test/sort2/rec4.xml deleted file mode 100644 index 8ed6c2c..0000000 --- a/test/sort2/rec4.xml +++ /dev/null @@ -1,3 +0,0 @@ - - the fourth computer - diff --git a/test/sort2/sort.chr b/test/sort2/sort.chr deleted file mode 100644 index 66d260b..0000000 --- a/test/sort2/sort.chr +++ /dev/null @@ -1,33 +0,0 @@ -# character map that removes some leading prefixes -# - -# 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/sort2.abs b/test/sort2/sort2.abs new file mode 100644 index 0000000..0c9f8a0 --- /dev/null +++ b/test/sort2/sort2.abs @@ -0,0 +1,13 @@ + +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/t1.c b/test/sort2/t1.c deleted file mode 100644 index 775b5ca..0000000 --- a/test/sort2/t1.c +++ /dev/null @@ -1,60 +0,0 @@ -/* This file is part of the Zebra server. - Copyright (C) 1995-2008 Index Data - -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 this program; if not, write to the Free Software -Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - -*/ - -#include "../api/testlib.h" - -static void tst(int argc, char **argv) -{ - ZebraService zs = tl_start_up(0, argc, argv); - ZebraHandle zh = zebra_open(zs, 0); - char path[256]; - int i; - zint ids[5]; - - YAZ_CHECK(zebra_select_database(zh, "Default") == ZEBRA_OK); - - zebra_init(zh); - - YAZ_CHECK(zebra_begin_trans(zh, 1) == ZEBRA_OK); - for (i = 1; i <= 4; i++) - { - sprintf(path, "%.200s/rec%d.xml", tl_get_srcdir(), i); - zebra_repository_update(zh, path); - } - YAZ_CHECK(zebra_end_trans(zh) == ZEBRA_OK); - zebra_commit(zh); - - ids[0] = 2; - ids[1] = 5; - ids[2] = 3; - ids[3] = 4; - YAZ_CHECK(tl_sort(zh, "@or @attr 1=4 computer @attr 7=1 @attr 1=4 0", 4, ids)); - - YAZ_CHECK(tl_close_down(zh, zs)); -} - -TL_MAIN -/* - * Local variables: - * c-basic-offset: 4 - * indent-tabs-mode: nil - * End: - * vim: shiftwidth=4 tabstop=8 expandtab - */ - diff --git a/test/sort2/test_sort2.c b/test/sort2/test_sort2.c new file mode 100644 index 0000000..38b4264 --- /dev/null +++ b/test/sort2/test_sort2.c @@ -0,0 +1,57 @@ +/* This file is part of the Zebra server. + Copyright (C) 1995-2008 Index Data + +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 this program; if not, write to the Free Software +Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +*/ + +#include "../api/testlib.h" + +static void tst(int argc, char **argv) +{ + ZebraService zs = tl_start_up("test_sort2.cfg", argc, argv); + ZebraHandle zh = zebra_open(zs, 0); + char path[256]; + zint ids[5]; + + YAZ_CHECK(zebra_select_database(zh, "Default") == ZEBRA_OK); + + zebra_init(zh); + + YAZ_CHECK(zebra_begin_trans(zh, 1) == ZEBRA_OK); + sprintf(path, "%.200s/test_sort2_rec.xml", tl_get_srcdir()); + zebra_repository_update(zh, path); + + YAZ_CHECK(zebra_end_trans(zh) == ZEBRA_OK); + zebra_commit(zh); + + ids[0] = 2; + ids[1] = 5; + ids[2] = 3; + ids[3] = 4; + YAZ_CHECK(tl_sort(zh, "@or @attr 1=4 computer @attr 7=1 @attr 1=4 0", 4, ids)); + + YAZ_CHECK(tl_close_down(zh, zs)); +} + +TL_MAIN +/* + * Local variables: + * c-basic-offset: 4 + * indent-tabs-mode: nil + * End: + * vim: shiftwidth=4 tabstop=8 expandtab + */ + diff --git a/test/sort2/test_sort2.cfg b/test/sort2/test_sort2.cfg new file mode 100644 index 0000000..59c371d --- /dev/null +++ b/test/sort2/test_sort2.cfg @@ -0,0 +1,13 @@ +# Simple Zebra configuration file +# +# 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 +isam: b + +index: test_sort2.idx diff --git a/test/sort2/test_sort2.chr b/test/sort2/test_sort2.chr new file mode 100644 index 0000000..66d260b --- /dev/null +++ b/test/sort2/test_sort2.chr @@ -0,0 +1,33 @@ +# character map that removes some leading prefixes +# + +# 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/test_sort2.idx b/test/sort2/test_sort2.idx new file mode 100644 index 0000000..f0988de --- /dev/null +++ b/test/sort2/test_sort2.idx @@ -0,0 +1,54 @@ +# Zebra indexes as referred to from the *.abs-files. +# + +# 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 test_sort2.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 test_sort2.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 test_sort2.chr + diff --git a/test/sort2/test_sort2_rec.xml b/test/sort2/test_sort2_rec.xml new file mode 100644 index 0000000..54d9295 --- /dev/null +++ b/test/sort2/test_sort2_rec.xml @@ -0,0 +1,12 @@ + + first computer + + + second computer + + + A third computer + + + the fourth computer + diff --git a/test/sort2/zebra.cfg b/test/sort2/zebra.cfg deleted file mode 100644 index 0cfe09a..0000000 --- a/test/sort2/zebra.cfg +++ /dev/null @@ -1,11 +0,0 @@ -# Simple Zebra configuration file -# -# 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 -isam: b -- 1.7.10.4