d55a7828284729188c48a956ffa9780492fb295c
[idzebra-moved-to-github.git] / test / api / t2.c
1 /* This file is part of the Zebra server.
2    Copyright (C) 1995-2008 Index Data
3
4 Zebra is free software; you can redistribute it and/or modify it under
5 the terms of the GNU General Public License as published by the Free
6 Software Foundation; either version 2, or (at your option) any later
7 version.
8
9 Zebra is distributed in the hope that it will be useful, but WITHOUT ANY
10 WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
12 for more details.
13
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
17
18 */
19
20 #include "testlib.h"
21
22 const char *myrec[] = {
23         "<gils>\n"
24         "  <title>My title</title>\n"
25         "</gils>\n",
26         0};
27
28 void tst(int argc, char **argv)
29 {
30     ZebraService zs = tl_start_up(0, argc, argv);
31     ZebraHandle  zh = zebra_open(zs, 0);
32
33     YAZ_CHECK(tl_init_data(zh, myrec));
34     YAZ_CHECK(tl_query(zh, "@attr 1=title my", 1));
35     YAZ_CHECK(tl_query(zh, "@attr 1=4 my", 1));
36     YAZ_CHECK(tl_query(zh, "@attr 1=title nope", 0));
37     YAZ_CHECK(tl_query(zh, "@attr 1=4 nope", 0));
38     YAZ_CHECK(tl_query(zh, "@attr 1=title @attr 2=103 dummy", 1));
39     YAZ_CHECK(tl_query(zh, "@attr 1=4 @attr 2=103 dummy", 1));
40
41     YAZ_CHECK(tl_close_down(zh, zs));
42 }
43
44 TL_MAIN
45
46 /*
47  * Local variables:
48  * c-basic-offset: 4
49  * indent-tabs-mode: nil
50  * End:
51  * vim: shiftwidth=4 tabstop=8 expandtab
52  */
53