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