From ce529949177ef63507c8becc93366df10d3d846a Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Wed, 16 Apr 2008 10:21:03 +0200 Subject: [PATCH] Added sort test. --- doc/common | 2 +- m4 | 2 +- test/api/.gitignore | 1 + test/api/Makefile.am | 14 +++++----- test/api/test_sortindex.c | 59 +++++++++++++++++++++++++++++++++++++++++++ test/api/test_sortindex.cfg | 10 ++++++++ 6 files changed, 80 insertions(+), 8 deletions(-) create mode 100644 test/api/test_sortindex.c create mode 100644 test/api/test_sortindex.cfg diff --git a/doc/common b/doc/common index be00ca1..3c4ff09 160000 --- a/doc/common +++ b/doc/common @@ -1 +1 @@ -Subproject commit be00ca12f99237a57164a03dbce2a78442355cf5 +Subproject commit 3c4ff09dc8ef24aa09fb3fad8630ec555c8e324c diff --git a/m4 b/m4 index a3d7a33..9763824 160000 --- a/m4 +++ b/m4 @@ -1 +1 @@ -Subproject commit a3d7a3375702caae9794ae3a724e51ae9ee46ac3 +Subproject commit 9763824ebc2240e71a2eff5bb5b3775ab56d0508 diff --git a/test/api/.gitignore b/test/api/.gitignore index 4f8516d..031d5e1 100644 --- a/test/api/.gitignore +++ b/test/api/.gitignore @@ -5,6 +5,7 @@ Makefile.in t[0-9] t[0-9][0-9] test_safari +test_sortindex *.mf *.LCK *.log diff --git a/test/api/Makefile.am b/test/api/Makefile.am index 478f57a..2ada879 100644 --- a/test/api/Makefile.am +++ b/test/api/Makefile.am @@ -2,13 +2,15 @@ noinst_PROGRAMS = testclient testclient_SOURCES = testclient.c -simpletests = t0 t1 t2 t3 t4 t5 t6 t7 t8 t9 t10 t11 t12 t13 t14 t15 t16 t17 -safaritests = test_safari -check_PROGRAMS = $(simpletests) $(safaritests) +check_PROGRAMS = t0 t1 t2 t3 t4 t5 t6 t7 t8 \ + t9 t10 t11 t12 t13 t14 t15 t16 t17 \ + test_sortindex test_safari + TESTS = $(check_PROGRAMS) -EXTRA_DIST=zebra.cfg zebra6.cfg zebra8.cfg zebra10.cfg zebra15.cfg safari.cfg \ - t10.att t10.abs zebra17.cfg t17.idx +EXTRA_DIST=zebra.cfg zebra6.cfg zebra8.cfg zebra10.cfg zebra15.cfg \ + t10.att t10.abs zebra17.cfg t17.idx \ + test_safari.cfg test_sortindex.cfg noinst_LIBRARIES = libtestlib.a @@ -32,7 +34,7 @@ t14_SOURCES = t14.c t15_SOURCES = t15.c t16_SOURCES = t16.c t17_SOURCES = t17.c - +test_sortindex_SOURCES = test_sortindex.c test_safari_SOURCES = test_safari.c testlib.c AM_CPPFLAGS = -I$(top_srcdir)/include $(YAZINC) diff --git a/test/api/test_sortindex.c b/test/api/test_sortindex.c new file mode 100644 index 0000000..934bfdc --- /dev/null +++ b/test/api/test_sortindex.c @@ -0,0 +1,59 @@ +/* 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 + +*/ + +/** \file + \brief test sortindex + */ + +#include +#include "testlib.h" + +const char *myrec[] = { + "\nMy title\n\n", + "\nMy x title\n\n", + "\nMy title x\n\n" , + 0} ; + +static void tst(int argc, char **argv) +{ + zint ids[5]; + + ZebraService zs = tl_start_up("test_sortindex.cfg", argc, argv); + ZebraHandle zh = zebra_open(zs, 0); + + YAZ_CHECK(tl_init_data(zh, myrec)); + + ids[0] = 2; + ids[1] = 4; + ids[2] = 3; + YAZ_CHECK(tl_sort(zh, "@or @attr 1=4 title @attr 7=1 @attr 1=4 0", 3, 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/api/test_sortindex.cfg b/test/api/test_sortindex.cfg new file mode 100644 index 0000000..4c43a0d --- /dev/null +++ b/test/api/test_sortindex.cfg @@ -0,0 +1,10 @@ +profilepath: ${srcdir:-.}/../../tab + +attset: bib1.att +attset: explain.att + +recordType: grs.sgml + +isam: b + +sortindex: i \ No newline at end of file -- 1.7.10.4