Added sort test.
authorAdam Dickmeiss <adam@indexdata.dk>
Wed, 16 Apr 2008 08:21:03 +0000 (10:21 +0200)
committerAdam Dickmeiss <adam@indexdata.dk>
Wed, 16 Apr 2008 08:21:03 +0000 (10:21 +0200)
doc/common
m4
test/api/.gitignore
test/api/Makefile.am
test/api/test_sortindex.c [new file with mode: 0644]
test/api/test_sortindex.cfg [new file with mode: 0644]

index be00ca1..3c4ff09 160000 (submodule)
@@ -1 +1 @@
-Subproject commit be00ca12f99237a57164a03dbce2a78442355cf5
+Subproject commit 3c4ff09dc8ef24aa09fb3fad8630ec555c8e324c
diff --git a/m4 b/m4
index a3d7a33..9763824 160000 (submodule)
--- a/m4
+++ b/m4
@@ -1 +1 @@
-Subproject commit a3d7a3375702caae9794ae3a724e51ae9ee46ac3
+Subproject commit 9763824ebc2240e71a2eff5bb5b3775ab56d0508
index 4f8516d..031d5e1 100644 (file)
@@ -5,6 +5,7 @@ Makefile.in
 t[0-9]
 t[0-9][0-9]
 test_safari
+test_sortindex
 *.mf
 *.LCK
 *.log
index 478f57a..2ada879 100644 (file)
@@ -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 (file)
index 0000000..934bfdc
--- /dev/null
@@ -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 <yaz/test.h>
+#include "testlib.h"
+
+const char *myrec[] = {
+        "<gils>\n<title>My title</title>\n</gils>\n",
+        "<gils>\n<title>My x title</title>\n</gils>\n",
+        "<gils>\n<title>My title x</title>\n</gils>\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 (file)
index 0000000..4c43a0d
--- /dev/null
@@ -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