Added date-range search tests.
authorAdam Dickmeiss <adam@indexdata.dk>
Fri, 18 Apr 2008 14:33:05 +0000 (16:33 +0200)
committerAdam Dickmeiss <adam@indexdata.dk>
Fri, 18 Apr 2008 14:33:05 +0000 (16:33 +0200)
test/api/Makefile.am
test/api/test_search.abs [new file with mode: 0644]
test/api/test_search.c
test/api/zebra.cfg

index 0564f32..4f0ce42 100644 (file)
@@ -12,7 +12,7 @@ check_PROGRAMS = test_start_stop test_result_sets \
 TESTS = $(check_PROGRAMS)
 
 EXTRA_DIST=zebra.cfg test_trunc.cfg test_private_attset.cfg \
-       private_attset.att private_attset.abs \
+       private_attset.att private_attset.abs test_search.abs \
        test_zebra_fork.cfg \
        test_icu_indexing.cfg test_icu_indexing.idx \
        test_safari.cfg test_sortindex.cfg \
diff --git a/test/api/test_search.abs b/test/api/test_search.abs
new file mode 100644 (file)
index 0000000..c8c5ebf
--- /dev/null
@@ -0,0 +1,9 @@
+name my
+reference WAIS-schema
+attset bib1.att
+
+esetname B @
+esetname F @
+
+xelm /test_search/title                title:p,title:w
+xelm /test_search/date         date:d
index 54fe529..55219f9 100644 (file)
@@ -30,8 +30,9 @@ const char *myrec[] = {
         "    <East-Bounding-Coordinate> -102 </East-Bounding-Coordinate>\n"
         "    <North-Bounding-Coordinate>  49 </North-Bounding-Coordinate>\n"
         "    <South-Bounding-Coordinate>  31 </South-Bounding-Coordinate>\n"
-        "  </Bounding-Coordinates></Spatial-Domain>"
+        "  </Bounding-Coordinates></Spatial-Domain>\n"
         "</gils>\n",
+
         "<gils>\n<title>My x title</title>\n"
         "  <abstract>second test with two coord sets</abstract>\n"
         "  <Spatial-Domain><Bounding-Coordinates>\n"
@@ -45,9 +46,15 @@ const char *myrec[] = {
         "    <East-Bounding-Coordinate> -108 </East-Bounding-Coordinate>\n"
         "    <North-Bounding-Coordinate>  41 </North-Bounding-Coordinate>\n"
         "    <South-Bounding-Coordinate>  25 </South-Bounding-Coordinate>\n"
-        "  </Bounding-Coordinates></Spatial-Domain>"
+        "  </Bounding-Coordinates></Spatial-Domain>\n"
         "</gils>\n",
+
         "<gils>\n<title>My title x</title>\n</gils>\n" ,
+
+        "<test_search>\n"
+        " <date>2107-09-19 00:00:00</date>\n"
+        "</test_search>\n"
+        ,
        0} ;
        
 static void tst(int argc, char **argv)
@@ -155,7 +162,7 @@ static void tst(int argc, char **argv)
     YAZ_CHECK(tl_query(zh, "@attr 1=4 @attr 2=5 title", 2));
 
     /* always-matches relation */
-    YAZ_CHECK(tl_query(zh, "@attr 1=_ALLRECORDS @attr 2=103 {ym}", 3));
+    YAZ_CHECK(tl_query(zh, "@attr 1=_ALLRECORDS @attr 2=103 {ym}", 4));
     YAZ_CHECK(tl_query(zh, "@attr 1=4 @attr 2=103 {x my}", 3));
     YAZ_CHECK(tl_query_x(zh, "@attr 1=1 @attr 2=103 {x my}", 0, 114));
 
@@ -313,7 +320,19 @@ static void tst(int argc, char **argv)
     /* N=41 and N=49 get only rec2 */
     YAZ_CHECK(tl_query(zh, "@attr 2=3 @attr gils 1=2040 @attr 4=109 \"41 49\" ", 1));
 
+
+    /* = */
+    YAZ_CHECK(tl_query(zh, "@attr 1=30 @attr 4=5 @attr 2=3 {2107-09-19 00:00:00}", 1));
+    /* < */
+    YAZ_CHECK(tl_query(zh, "@attr 1=30 @attr 4=5 @attr 2=1 {2107-09-19 00:00:00}", 0));
+    /* <= */
+    YAZ_CHECK(tl_query(zh, "@attr 1=30 @attr 4=5 @attr 2=2 {2107-09-19 00:00:00}", 1));
+    /* >= */
+    YAZ_CHECK(tl_query(zh, "@attr 1=30 @attr 4=5 @attr 2=4 {2107-09-19 00:00:00}", 1));
+    /* > */
+    YAZ_CHECK(tl_query(zh, "@attr 1=30 @attr 4=5 @attr 2=5 {2107-09-19 00:00:00}", 0));
     
+
     YAZ_CHECK(tl_close_down(zh, zs));
 }
 
index 3a1549f..187555b 100644 (file)
@@ -1,4 +1,4 @@
-profilepath: ${srcdir:-.}/../../tab
+profilepath: ${srcdir:-.}:${srcdir:-.}/../../tab
 
 attset: bib1.att
 attset: gils.att