projects
/
yaz-moved-to-github.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
tcpip: connect tries all getaddrinfo addresses YAZ-743
[yaz-moved-to-github.git]
/
test
/
test_xmlquery.c
diff --git
a/test/test_xmlquery.c
b/test/test_xmlquery.c
index
c1e9034
..
513311b
100644
(file)
--- a/
test/test_xmlquery.c
+++ b/
test/test_xmlquery.c
@@
-1,7
+1,10
@@
/* This file is part of the YAZ toolkit.
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) Index Data
* See the file LICENSE for details.
*/
* See the file LICENSE for details.
*/
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
#include <stdlib.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdio.h>
@@
-49,7
+52,7
@@
enum pqf2xml_status pqf2xml_text(const char *pqf, const char *expect_xml,
xmlDocPtr doc = 0;
yaz_rpnquery2xml(rpn, &doc);
xmlDocPtr doc = 0;
yaz_rpnquery2xml(rpn, &doc);
-
+
if (!doc)
status = QUERY2XML_FAILED;
else
if (!doc)
status = QUERY2XML_FAILED;
else
@@
-58,7
+61,7
@@
enum pqf2xml_status pqf2xml_text(const char *pqf, const char *expect_xml,
int len_out;
xmlDocDumpMemory(doc, (xmlChar **) &buf_out, &len_out);
int len_out;
xmlDocDumpMemory(doc, (xmlChar **) &buf_out, &len_out);
-
+
if (len_out == (int) strlen(expect_xml)
&& memcmp(buf_out, expect_xml, len_out) == 0)
{
if (len_out == (int) strlen(expect_xml)
&& memcmp(buf_out, expect_xml, len_out) == 0)
{
@@
-67,7
+70,7
@@
enum pqf2xml_status pqf2xml_text(const char *pqf, const char *expect_xml,
const char *addinfo = 0;
const xmlNode *root_element = xmlDocGetRootElement(doc);
ODR odr2 = odr_createmem(ODR_ENCODE);
const char *addinfo = 0;
const xmlNode *root_element = xmlDocGetRootElement(doc);
ODR odr2 = odr_createmem(ODR_ENCODE);
-
+
yaz_xml2query(root_element, &query2, odr2,
&error_code, &addinfo);
if (error_code || !query2)
yaz_xml2query(root_element, &query2, odr2,
&error_code, &addinfo);
if (error_code || !query2)
@@
-108,7
+111,7
@@
static void tst(void)
YAZ_CHECK_EQ(pqf2xml_text("@attr 1=4 bad query", "", 0), PQF_FAILED);
#if YAZ_HAVE_XML2
YAZ_CHECK_EQ(pqf2xml_text(
YAZ_CHECK_EQ(pqf2xml_text("@attr 1=4 bad query", "", 0), PQF_FAILED);
#if YAZ_HAVE_XML2
YAZ_CHECK_EQ(pqf2xml_text(
- "@attr 1=4 computer",
+ "@attr 1=4 computer",
"<?xml version=\"1.0\"?>\n"
"<query><rpn set=\"Bib-1\">"
"<apt><attr type=\"1\" value=\"4\"/>"
"<?xml version=\"1.0\"?>\n"
"<query><rpn set=\"Bib-1\">"
"<apt><attr type=\"1\" value=\"4\"/>"
@@
-116,7
+119,7
@@
static void tst(void)
"</rpn></query>\n",
"RPN @attrset Bib-1 @attr 1=4 computer"
), XML_MATCH);
"</rpn></query>\n",
"RPN @attrset Bib-1 @attr 1=4 computer"
), XML_MATCH);
-
+
YAZ_CHECK_EQ(pqf2xml_text(
"@attr 2=1 @attr 1=title computer",
"<?xml version=\"1.0\"?>\n"
YAZ_CHECK_EQ(pqf2xml_text(
"@attr 2=1 @attr 1=title computer",
"<?xml version=\"1.0\"?>\n"
@@
-125,7
+128,7
@@
static void tst(void)
"<attr type=\"2\" value=\"1\"/>"
"<term type=\"general\">computer</term></apt>"
"</rpn></query>\n",
"<attr type=\"2\" value=\"1\"/>"
"<term type=\"general\">computer</term></apt>"
"</rpn></query>\n",
- "RPN @attrset Bib-1 @attr \"1=title\" @attr 2=1 computer"
+ "RPN @attrset Bib-1 @attr 1=title @attr 2=1 computer"
), XML_MATCH);
YAZ_CHECK_EQ(pqf2xml_text(
), XML_MATCH);
YAZ_CHECK_EQ(pqf2xml_text(
@@
-138,9
+141,9
@@
static void tst(void)
"</rpn></query>\n",
"RPN @attrset Bib-1 @attr Exp-1 1=1 @attr 2=1 computer"
), XML_MATCH);
"</rpn></query>\n",
"RPN @attrset Bib-1 @attr Exp-1 1=1 @attr 2=1 computer"
), XML_MATCH);
-
+
YAZ_CHECK_EQ(pqf2xml_text(
YAZ_CHECK_EQ(pqf2xml_text(
- "@and a b",
+ "@and a b",
"<?xml version=\"1.0\"?>\n"
"<query><rpn set=\"Bib-1\">"
"<operator type=\"and\">"
"<?xml version=\"1.0\"?>\n"
"<query><rpn set=\"Bib-1\">"
"<operator type=\"and\">"
@@
-149,9
+152,9
@@
static void tst(void)
"</operator></rpn></query>\n",
"RPN @attrset Bib-1 @and a b"
), XML_MATCH);
"</operator></rpn></query>\n",
"RPN @attrset Bib-1 @and a b"
), XML_MATCH);
-
+
YAZ_CHECK_EQ(pqf2xml_text(
YAZ_CHECK_EQ(pqf2xml_text(
- "@or @and a b c",
+ "@or @and a b c",
"<?xml version=\"1.0\"?>\n"
"<query><rpn set=\"Bib-1\">"
"<operator type=\"or\">"
"<?xml version=\"1.0\"?>\n"
"<query><rpn set=\"Bib-1\">"
"<operator type=\"or\">"
@@
-164,7
+167,7
@@
static void tst(void)
), XML_MATCH);
YAZ_CHECK_EQ(pqf2xml_text(
), XML_MATCH);
YAZ_CHECK_EQ(pqf2xml_text(
- "@set abe",
+ "@set abe",
"<?xml version=\"1.0\"?>\n"
"<query><rpn set=\"Bib-1\">"
"<rset>abe</rset></rpn></query>\n",
"<?xml version=\"1.0\"?>\n"
"<query><rpn set=\"Bib-1\">"
"<rset>abe</rset></rpn></query>\n",
@@
-172,9
+175,9
@@
static void tst(void)
), XML_MATCH);
YAZ_CHECK_EQ(pqf2xml_text(
), XML_MATCH);
YAZ_CHECK_EQ(pqf2xml_text(
- /* exclusion, distance, ordered, relationtype,
+ /* exclusion, distance, ordered, relationtype,
knownunit, proxunit */
knownunit, proxunit */
- "@prox 0 3 1 2 k 2 a b",
+ "@prox 0 3 1 2 k 2 a b",
"<?xml version=\"1.0\"?>\n"
"<query><rpn set=\"Bib-1\">"
"<operator type=\"prox\" exclusion=\"false\" "
"<?xml version=\"1.0\"?>\n"
"<query><rpn set=\"Bib-1\">"
"<operator type=\"prox\" exclusion=\"false\" "
@@
-189,7
+192,7
@@
static void tst(void)
), XML_MATCH);
YAZ_CHECK_EQ(pqf2xml_text(
), XML_MATCH);
YAZ_CHECK_EQ(pqf2xml_text(
- "@term numeric 32",
+ "@term numeric 32",
"<?xml version=\"1.0\"?>\n"
"<query><rpn set=\"Bib-1\">"
"<apt>"
"<?xml version=\"1.0\"?>\n"
"<query><rpn set=\"Bib-1\">"
"<apt>"
@@
-197,9
+200,9
@@
static void tst(void)
"</rpn></query>\n",
"RPN @attrset Bib-1 @term numeric 32"
), XML_MATCH);
"</rpn></query>\n",
"RPN @attrset Bib-1 @term numeric 32"
), XML_MATCH);
-
+
YAZ_CHECK_EQ(pqf2xml_text(
YAZ_CHECK_EQ(pqf2xml_text(
- "@term string computer",
+ "@term string computer",
"<?xml version=\"1.0\"?>\n"
"<query><rpn set=\"Bib-1\">"
"<apt>"
"<?xml version=\"1.0\"?>\n"
"<query><rpn set=\"Bib-1\">"
"<apt>"
@@
-207,9
+210,9
@@
static void tst(void)
"</rpn></query>\n",
"RPN @attrset Bib-1 @term string computer"
), XML_MATCH);
"</rpn></query>\n",
"RPN @attrset Bib-1 @term string computer"
), XML_MATCH);
-
+
YAZ_CHECK_EQ(pqf2xml_text(
YAZ_CHECK_EQ(pqf2xml_text(
- "@term null void",
+ "@term null void",
"<?xml version=\"1.0\"?>\n"
"<query><rpn set=\"Bib-1\">"
"<apt>"
"<?xml version=\"1.0\"?>\n"
"<query><rpn set=\"Bib-1\">"
"<apt>"
@@
-219,7
+222,7
@@
static void tst(void)
), XML_MATCH);
YAZ_CHECK_EQ(pqf2xml_text(
), XML_MATCH);
YAZ_CHECK_EQ(pqf2xml_text(
- "@attrset gils @attr 4=2 x",
+ "@attrset gils @attr 4=2 x",
"<?xml version=\"1.0\"?>\n"
"<query><rpn set=\"GILS\">"
"<apt>"
"<?xml version=\"1.0\"?>\n"
"<query><rpn set=\"GILS\">"
"<apt>"