ZOOM: For redirect, reconnect always YAZ-722
[yaz-moved-to-github.git] / test / test_rpn2cql.c
index b9b4292..0d929e5 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2012 Index Data
+ * Copyright (C) Index Data
  * See the file LICENSE for details.
  */
 #if HAVE_CONFIG_H
@@ -59,6 +59,11 @@ static void tst1(void)
     YAZ_CHECK(compare(ct, "abc", "abc"));
     YAZ_CHECK(compare(ct, "\"a b c\"", "\"a b c\""));
     YAZ_CHECK(compare(ct, "@and a b", "a and b"));
+    YAZ_CHECK(compare(ct, "@or a @and b c", "a or (b and c)"));
+    YAZ_CHECK(compare(ct, "@or @and a b @and c d", "(a and b) or (c and d)"));
+    YAZ_CHECK(compare(ct, "@or @or a b @or c d", "(a or b) or (c or d)"));
+    YAZ_CHECK(compare(ct, "@and @and a b @and c d", "(a and b) and (c and d)"));
+
     YAZ_CHECK(compare(ct, "@attr 1=field abc", "field=abc"));
     YAZ_CHECK(compare(ct, "@attr 1=4 abc", 0)); /* should fail */
 
@@ -90,11 +95,12 @@ static void tst2(void)
     YAZ_CHECK(compare(ct, "@attr 1=4 @attr 4=1 @attr 6=1 abc", "dc.title=abc"));
     YAZ_CHECK(compare(ct, "@attr 1=1016 abc", "abc"));
     /* Date tests */
-    YAZ_CHECK(compare(ct, "@attr 2=1 @attr 1=30 1980", "dc.date<1980"));
-    YAZ_CHECK(compare(ct, "@attr 1=30 @attr 2=3 1980", "dc.date=1980"));
-    YAZ_CHECK(compare(ct, "@attr 1=30 @attr 2=5 1980", "dc.date>1980"));
+    YAZ_CHECK(compare(ct, "@attr 1=30 @attr 2=1 1980", "dc.date<1980"));
     YAZ_CHECK(compare(ct, "@attr 1=30 @attr 2=2 1980", "dc.date<=1980"));
+    YAZ_CHECK(compare(ct, "@attr 1=30 @attr 2=3 1980", "dc.date=1980"));
     YAZ_CHECK(compare(ct, "@attr 1=30 @attr 2=4 1980", "dc.date>=1980"));
+    YAZ_CHECK(compare(ct, "@attr 1=30 @attr 2=5 1980", "dc.date>1980"));
+    YAZ_CHECK(compare(ct, "@and @attr 1=30 @attr 2=4 234 @attr 1=30 @attr 2=2 1990", "dc.date>=234 and dc.date<=1990"));
 
     /* Truncation */
     YAZ_CHECK(compare(ct, "@attr 5=1 water", "water*"));