Added tests for pql2cql using relation and truncation.
[yaz-moved-to-github.git] / test / tst_query_charset.c
index c597e65..1c3bb18 100644 (file)
@@ -1,14 +1,13 @@
-/*
- * Copyright (C) 1995-2007, Index Data ApS
+/* This file is part of the YAZ toolkit.
+ * Copyright (C) 1995-2009 Index Data
  * See the file LICENSE for details.
- *
- * $Id: tst_query_charset.c,v 1.1 2007-04-10 14:42:31 adam Exp $
  */
 
 #include <stdlib.h>
 #include <stdio.h>
 
 #include <yaz/query-charset.h>
+#include <yaz/copy_types.h>
 #include <yaz/pquery.h>
 #include <yaz/querytowrbuf.h>
 #include <yaz/test.h>
@@ -42,7 +41,10 @@ enum query_charset_status t(yaz_iconv_t cd,
     else
     {
         WRBUF w = wrbuf_alloc();
+        Z_RPNQuery *r2 = yaz_copy_z_RPNQuery(rpn, odr);
 
+        YAZ_CHECK(r2);
+        YAZ_CHECK(r2 != rpn);
         yaz_query_charset_convert_rpnquery(rpn, odr, cd);
         yaz_rpnquery_to_wrbuf(w, rpn);
         if (!expect_pqf || strcmp(expect_pqf, wrbuf_cstr(w)) == 0)
@@ -85,6 +87,7 @@ int main (int argc, char **argv)
 /*
  * Local variables:
  * c-basic-offset: 4
+ * c-file-style: "Stroustrup"
  * indent-tabs-mode: nil
  * End:
  * vim: shiftwidth=4 tabstop=8 expandtab