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
Special value -1.0 means 'could not get timings' on current platform.
[yaz-moved-to-github.git]
/
test
/
tstxmlquery.c
diff --git
a/test/tstxmlquery.c
b/test/tstxmlquery.c
index
7ed5477
..
bb3e334
100644
(file)
--- a/
test/tstxmlquery.c
+++ b/
test/tstxmlquery.c
@@
-1,8
+1,8
@@
/*
/*
- * Copyright (C) 1995-2005, Index Data ApS
+ * Copyright (C) 1995-2007, Index Data ApS
* See the file LICENSE for details.
*
* See the file LICENSE for details.
*
- * $Id: tstxmlquery.c,v 1.9 2006-02-19 18:44:23 adam Exp $
+ * $Id: tstxmlquery.c,v 1.14 2007-01-03 08:42:16 adam Exp $
*/
#include <stdlib.h>
*/
#include <stdlib.h>
@@
-14,7
+14,7
@@
#include <yaz/pquery.h>
#include <yaz/test.h>
#include <yaz/pquery.h>
#include <yaz/test.h>
-#if HAVE_XML2
+#if YAZ_HAVE_XML2
#include <libxml/parser.h>
#include <libxml/tree.h>
#endif
#include <libxml/parser.h>
#include <libxml/tree.h>
#endif
@@
-47,7
+47,7
@@
enum pqf2xml_status pqf2xml_text(const char *pqf, const char *expect_xml,
status = PQF_FAILED;
else
{
status = PQF_FAILED;
else
{
-#if HAVE_XML2
+#if YAZ_HAVE_XML2
xmlDocPtr doc = 0;
yaz_rpnquery2xml(rpn, &doc);
xmlDocPtr doc = 0;
yaz_rpnquery2xml(rpn, &doc);
@@
-104,72
+104,72
@@
enum pqf2xml_status pqf2xml_text(const char *pqf, const char *expect_xml,
return status;
}
return status;
}
-static void tst()
+static void tst(void)
{
YAZ_CHECK_EQ(pqf2xml_text("@attr 1=4 bad query", "", 0), PQF_FAILED);
{
YAZ_CHECK_EQ(pqf2xml_text("@attr 1=4 bad query", "", 0), PQF_FAILED);
-#if HAVE_XML2
+#if YAZ_HAVE_XML2
YAZ_CHECK_EQ(pqf2xml_text(
"@attr 1=4 computer",
"<?xml version=\"1.0\"?>\n"
YAZ_CHECK_EQ(pqf2xml_text(
"@attr 1=4 computer",
"<?xml version=\"1.0\"?>\n"
- "<query set=\"Bib-1\" type=\"rpn\">"
+ "<query><rpn set=\"Bib-1\">"
"<apt><attr type=\"1\" value=\"4\"/>"
"<term type=\"general\">computer</term></apt>"
"<apt><attr type=\"1\" value=\"4\"/>"
"<term type=\"general\">computer</term></apt>"
- "</query>\n",
- "RPN: @attrset Bib-1 @attr 1=4 computer"
+ "</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"
), XML_MATCH);
YAZ_CHECK_EQ(pqf2xml_text(
"@attr 2=1 @attr 1=title computer",
"<?xml version=\"1.0\"?>\n"
- "<query set=\"Bib-1\" type=\"rpn\">"
+ "<query><rpn set=\"Bib-1\">"
"<apt><attr type=\"1\" value=\"title\"/>"
"<attr type=\"2\" value=\"1\"/>"
"<term type=\"general\">computer</term></apt>"
"<apt><attr type=\"1\" value=\"title\"/>"
"<attr type=\"2\" value=\"1\"/>"
"<term type=\"general\">computer</term></apt>"
- "</query>\n",
- "RPN: @attrset Bib-1 @attr \"1=title\" @attr 2=1 computer"
+ "</rpn></query>\n",
+ "RPN @attrset Bib-1 @attr \"1=title\" @attr 2=1 computer"
), XML_MATCH);
YAZ_CHECK_EQ(pqf2xml_text(
"@attr 2=1 @attr exp1 1=1 computer",
"<?xml version=\"1.0\"?>\n"
), XML_MATCH);
YAZ_CHECK_EQ(pqf2xml_text(
"@attr 2=1 @attr exp1 1=1 computer",
"<?xml version=\"1.0\"?>\n"
- "<query set=\"Bib-1\" type=\"rpn\">"
+ "<query><rpn set=\"Bib-1\">"
"<apt><attr set=\"Exp-1\" type=\"1\" value=\"1\"/>"
"<attr type=\"2\" value=\"1\"/>"
"<term type=\"general\">computer</term></apt>"
"<apt><attr set=\"Exp-1\" type=\"1\" value=\"1\"/>"
"<attr type=\"2\" value=\"1\"/>"
"<term type=\"general\">computer</term></apt>"
- "</query>\n",
- "RPN: @attrset Bib-1 @attr Exp-1 1=1 @attr 2=1 computer"
+ "</rpn></query>\n",
+ "RPN @attrset Bib-1 @attr Exp-1 1=1 @attr 2=1 computer"
), XML_MATCH);
YAZ_CHECK_EQ(pqf2xml_text(
"@and a b",
"<?xml version=\"1.0\"?>\n"
), XML_MATCH);
YAZ_CHECK_EQ(pqf2xml_text(
"@and a b",
"<?xml version=\"1.0\"?>\n"
- "<query set=\"Bib-1\" type=\"rpn\">"
- "<binary type=\"and\">"
+ "<query><rpn set=\"Bib-1\">"
+ "<operator type=\"and\">"
"<apt><term type=\"general\">a</term></apt>"
"<apt><term type=\"general\">b</term></apt>"
"<apt><term type=\"general\">a</term></apt>"
"<apt><term type=\"general\">b</term></apt>"
- "</binary></query>\n",
- "RPN: @attrset Bib-1 @and a b"
+ "</operator></rpn></query>\n",
+ "RPN @attrset Bib-1 @and a b"
), XML_MATCH);
YAZ_CHECK_EQ(pqf2xml_text(
"@or @and a b c",
"<?xml version=\"1.0\"?>\n"
), XML_MATCH);
YAZ_CHECK_EQ(pqf2xml_text(
"@or @and a b c",
"<?xml version=\"1.0\"?>\n"
- "<query set=\"Bib-1\" type=\"rpn\">"
- "<binary type=\"or\">"
- "<binary type=\"and\">"
+ "<query><rpn set=\"Bib-1\">"
+ "<operator type=\"or\">"
+ "<operator type=\"and\">"
"<apt><term type=\"general\">a</term></apt>"
"<apt><term type=\"general\">a</term></apt>"
- "<apt><term type=\"general\">b</term></apt></binary>"
+ "<apt><term type=\"general\">b</term></apt></operator>"
"<apt><term type=\"general\">c</term></apt>"
"<apt><term type=\"general\">c</term></apt>"
- "</binary></query>\n",
- "RPN: @attrset Bib-1 @or @and a b c"
+ "</operator></rpn></query>\n",
+ "RPN @attrset Bib-1 @or @and a b c"
), XML_MATCH);
YAZ_CHECK_EQ(pqf2xml_text(
"@set abe",
"<?xml version=\"1.0\"?>\n"
), XML_MATCH);
YAZ_CHECK_EQ(pqf2xml_text(
"@set abe",
"<?xml version=\"1.0\"?>\n"
- "<query set=\"Bib-1\" type=\"rpn\">"
- "<rset>abe</rset></query>\n",
- "RPN: @attrset Bib-1 @set abe"
+ "<query><rpn set=\"Bib-1\">"
+ "<rset>abe</rset></rpn></query>\n",
+ "RPN @attrset Bib-1 @set abe"
), XML_MATCH);
YAZ_CHECK_EQ(pqf2xml_text(
), XML_MATCH);
YAZ_CHECK_EQ(pqf2xml_text(
@@
-177,57
+177,57
@@
static void tst()
knownunit, proxunit */
"@prox 0 3 1 2 k 2 a b",
"<?xml version=\"1.0\"?>\n"
knownunit, proxunit */
"@prox 0 3 1 2 k 2 a b",
"<?xml version=\"1.0\"?>\n"
- "<query set=\"Bib-1\" type=\"rpn\">"
- "<binary type=\"prox\" exclusion=\"false\" "
+ "<query><rpn set=\"Bib-1\">"
+ "<operator type=\"prox\" exclusion=\"false\" "
"distance=\"3\" "
"ordered=\"true\" "
"relationType=\"2\" "
"knownProximityUnit=\"2\">"
"<apt><term type=\"general\">a</term></apt>"
"<apt><term type=\"general\">b</term></apt>"
"distance=\"3\" "
"ordered=\"true\" "
"relationType=\"2\" "
"knownProximityUnit=\"2\">"
"<apt><term type=\"general\">a</term></apt>"
"<apt><term type=\"general\">b</term></apt>"
- "</binary></query>\n",
- "RPN: @attrset Bib-1 @prox 0 3 1 2 k 2 a b"
+ "</operator></rpn></query>\n",
+ "RPN @attrset Bib-1 @prox 0 3 1 2 k 2 a b"
), XML_MATCH);
YAZ_CHECK_EQ(pqf2xml_text(
"@term numeric 32",
"<?xml version=\"1.0\"?>\n"
), XML_MATCH);
YAZ_CHECK_EQ(pqf2xml_text(
"@term numeric 32",
"<?xml version=\"1.0\"?>\n"
- "<query set=\"Bib-1\" type=\"rpn\">"
+ "<query><rpn set=\"Bib-1\">"
"<apt>"
"<term type=\"numeric\">32</term></apt>"
"<apt>"
"<term type=\"numeric\">32</term></apt>"
- "</query>\n",
- "RPN: @attrset Bib-1 @term numeric 32"
+ "</rpn></query>\n",
+ "RPN @attrset Bib-1 @term numeric 32"
), XML_MATCH);
YAZ_CHECK_EQ(pqf2xml_text(
"@term string computer",
"<?xml version=\"1.0\"?>\n"
), XML_MATCH);
YAZ_CHECK_EQ(pqf2xml_text(
"@term string computer",
"<?xml version=\"1.0\"?>\n"
- "<query set=\"Bib-1\" type=\"rpn\">"
+ "<query><rpn set=\"Bib-1\">"
"<apt>"
"<term type=\"string\">computer</term></apt>"
"<apt>"
"<term type=\"string\">computer</term></apt>"
- "</query>\n",
- "RPN: @attrset Bib-1 @term string computer"
+ "</rpn></query>\n",
+ "RPN @attrset Bib-1 @term string computer"
), XML_MATCH);
YAZ_CHECK_EQ(pqf2xml_text(
"@term null void",
"<?xml version=\"1.0\"?>\n"
), XML_MATCH);
YAZ_CHECK_EQ(pqf2xml_text(
"@term null void",
"<?xml version=\"1.0\"?>\n"
- "<query set=\"Bib-1\" type=\"rpn\">"
+ "<query><rpn set=\"Bib-1\">"
"<apt>"
"<term type=\"null\"/></apt>"
"<apt>"
"<term type=\"null\"/></apt>"
- "</query>\n",
- "RPN: @attrset Bib-1 @term null x"
+ "</rpn></query>\n",
+ "RPN @attrset Bib-1 @term null x"
), XML_MATCH);
YAZ_CHECK_EQ(pqf2xml_text(
"@attrset gils @attr 4=2 x",
"<?xml version=\"1.0\"?>\n"
), XML_MATCH);
YAZ_CHECK_EQ(pqf2xml_text(
"@attrset gils @attr 4=2 x",
"<?xml version=\"1.0\"?>\n"
- "<query set=\"GILS\" type=\"rpn\">"
+ "<query><rpn set=\"GILS\">"
"<apt>"
"<attr type=\"4\" value=\"2\"/>"
"<term type=\"general\">x</term></apt>"
"<apt>"
"<attr type=\"4\" value=\"2\"/>"
"<term type=\"general\">x</term></apt>"
- "</query>\n",
- "RPN: @attrset GILS @attr 4=2 x"
+ "</rpn></query>\n",
+ "RPN @attrset GILS @attr 4=2 x"
), XML_MATCH);
#endif
}
), XML_MATCH);
#endif
}