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
Add debian make rule
[yaz-moved-to-github.git]
/
test
/
tstodrstack.c
diff --git
a/test/tstodrstack.c
b/test/tstodrstack.c
index
a1d6bc7
..
2cde413
100644
(file)
--- a/
test/tstodrstack.c
+++ b/
test/tstodrstack.c
@@
-1,15
+1,24
@@
+/* This file is part of the YAZ toolkit.
+ * Copyright (C) 1995-2009 Index Data
+ * See the file LICENSE for details.
+ */
#include <stdlib.h>
#include <yaz/pquery.h>
#include <yaz/proto.h>
#include <stdlib.h>
#include <yaz/pquery.h>
#include <yaz/proto.h>
+#include <yaz/test.h>
/** \brief build a 100 level query */
/** \brief build a 100 level query */
-void test1()
+void test1(void)
{
ODR odr = odr_createmem(ODR_ENCODE);
YAZ_PQF_Parser parser = yaz_pqf_create();
Z_RPNQuery *rpn_query;
char qstr[10000];
int i;
{
ODR odr = odr_createmem(ODR_ENCODE);
YAZ_PQF_Parser parser = yaz_pqf_create();
Z_RPNQuery *rpn_query;
char qstr[10000];
int i;
+ int ret;
+
+ YAZ_CHECK(odr);
+ YAZ_CHECK(parser);
*qstr = '\0';
for (i = 0; i<100; i++)
*qstr = '\0';
for (i = 0; i<100; i++)
@@
-17,37
+26,33
@@
void test1()
strcat(qstr, "1");
rpn_query = yaz_pqf_parse (parser, odr, qstr);
strcat(qstr, "1");
rpn_query = yaz_pqf_parse (parser, odr, qstr);
+ YAZ_CHECK(rpn_query);
- if (!rpn_query)
- exit(1);
-
- if (!z_RPNQuery(odr, &rpn_query, 0, 0))
- {
- odr_perror(odr, "Encoding query");
- exit(1);
- }
+ ret = z_RPNQuery(odr, &rpn_query, 0, 0);
+ YAZ_CHECK(ret);
yaz_pqf_destroy(parser);
odr_destroy(odr);
}
/** \brief build a circular referenced query */
yaz_pqf_destroy(parser);
odr_destroy(odr);
}
/** \brief build a circular referenced query */
-void test2()
+void test2(void)
{
ODR odr = odr_createmem(ODR_ENCODE);
YAZ_PQF_Parser parser = yaz_pqf_create();
Z_RPNQuery *rpn_query;
{
ODR odr = odr_createmem(ODR_ENCODE);
YAZ_PQF_Parser parser = yaz_pqf_create();
Z_RPNQuery *rpn_query;
+ int ret;
- rpn_query = yaz_pqf_parse (parser, odr, "@and @and a b c");
+ YAZ_CHECK(odr);
- if (!rpn_query)
- exit(1);
+ rpn_query = yaz_pqf_parse (parser, odr, "@and @and a b c");
+ YAZ_CHECK(rpn_query);
/* make the circular reference */
rpn_query->RPNStructure->u.complex->s1 = rpn_query->RPNStructure;
/* make the circular reference */
rpn_query->RPNStructure->u.complex->s1 = rpn_query->RPNStructure;
- if (z_RPNQuery(odr, &rpn_query, 0, 0)) /* should fail */
- exit(2);
+ ret = z_RPNQuery(odr, &rpn_query, 0, 0); /* should fail */
+ YAZ_CHECK(!ret);
yaz_pqf_destroy(parser);
odr_destroy(odr);
yaz_pqf_destroy(parser);
odr_destroy(odr);
@@
-55,14
+60,17
@@
void test2()
int main(int argc, char **argv)
{
int main(int argc, char **argv)
{
+ YAZ_CHECK_INIT(argc, argv);
test1();
test2();
test1();
test2();
- exit(0);
+ YAZ_CHECK_TERM;
}
/*
* Local variables:
* c-basic-offset: 4
}
/*
* Local variables:
* c-basic-offset: 4
+ * c-file-style: "Stroustrup"
* indent-tabs-mode: nil
* End:
* vim: shiftwidth=4 tabstop=8 expandtab
*/
* indent-tabs-mode: nil
* End:
* vim: shiftwidth=4 tabstop=8 expandtab
*/
+