28b90934b98c83020c7af98dc3ca561ea5c1a289
[yazpp-moved-to-github.git] / src / tstquery.cpp
1 /*
2  * Copyright (c) 1998-2006, Index Data.
3  * See the file LICENSE for details.
4  * 
5  * $Id: tstquery.cpp,v 1.3 2006-07-07 12:57:15 adam Exp $
6  */
7
8 #include <stdlib.h>
9 #include <yazpp/z-query.h>
10
11 using namespace yazpp_1;
12
13 void tst1(const char *query_str_in, const char *query_expected)
14 {
15     Yaz_Z_Query q;
16
17     q = query_str_in;
18
19     Yaz_Z_Query q2;
20
21     q2 = q;
22
23     char query_str_out[100];
24     q2.print(query_str_out, sizeof(query_str_out)-1);
25
26     if (strcmp(query_str_out, query_expected))
27     {
28         fprintf(stderr, "tstquery: query mismatch out=%s expected=%s\n",
29                 query_str_out, query_expected);
30         exit(1);
31     }
32 }
33
34 int main(int argc, char **argv)
35 {
36     tst1("", "");
37     tst1("x", "RPN @attrset Bib-1 x");
38     tst1("@and a b", "RPN @attrset Bib-1 @and a b");
39 }
40
41 /*
42  * Local variables:
43  * c-basic-offset: 4
44  * indent-tabs-mode: nil
45  * End:
46  * vim: shiftwidth=4 tabstop=8 expandtab
47  */