CCL: tests for configurable mask/truncation
[yaz-moved-to-github.git] / test / test_ccl.c
index 427a3a6..d189f00 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2012 Index Data
+ * Copyright (C) 1995-2013 Index Data
  * See the file LICENSE for details.
  */
 #if HAVE_CONFIG_H
@@ -429,6 +429,9 @@ void tst2(void)
     ccl_qual_fitem(bibset, "u=4    s=pw t=l,r", "ti");
     ccl_qual_fitem(bibset, "1=1016 s=al,pw t=z",    "term");
 
+    YAZ_CHECK(tst_ccl_query(bibset, "a?#",
+                            "@attr 5=104 @attr 4=2 @attr 1=1016 a?# "));
+
     YAZ_CHECK(tst_ccl_query(bibset, "a*",
                             "@attr 4=2 @attr 1=1016 a* "));
 
@@ -442,6 +445,16 @@ void tst2(void)
     YAZ_CHECK(tst_ccl_query(bibset, "a?",
                             "@attr 5=104 @attr 4=2 @attr 1=1016 a\\\\? "));
 
+    ccl_qual_fitem(bibset, "?", "@mask");
+    YAZ_CHECK(tst_ccl_query(bibset, "a?",
+                            "@attr 5=104 @attr 4=2 @attr 1=1016 a# "));
+
+
+    ccl_qual_fitem(bibset, "", "@mask");
+    ccl_qual_fitem(bibset, "", "@truncation");
+    YAZ_CHECK(tst_ccl_query(bibset, "a?#",
+                            "@attr 5=104 @attr 4=2 @attr 1=1016 a\\\\?\\\\# "));
+
     ccl_qual_fitem(bibset, "og", "@and");
     ccl_qual_fitem(bibset, "eller", "@or");
     ccl_qual_fitem(bibset, "ikke", "@not");