Reformat: delete trailing whitespace
[idzebra-moved-to-github.git] / test / xpath / xpath6.c
1 /* This file is part of the Zebra server.
2    Copyright (C) 1994-2011 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 #if HAVE_CONFIG_H
21 #include <config.h>
22 #endif
23 #include "../api/testlib.h"
24
25 static void tst(int argc, char **argv)
26 {
27     int i;
28     ZebraService zs = tl_start_up(0, argc, argv);
29     ZebraHandle zh = zebra_open(zs, 0);
30     char path[256];
31
32     YAZ_CHECK(zebra_select_database(zh, "Default") == ZEBRA_OK);
33
34     zebra_init(zh);
35
36     tl_check_filter(zs, "grs.xml");
37
38     zebra_set_resource(zh, "recordType", "grs.xml");
39
40     YAZ_CHECK(zebra_begin_trans(zh, 1) == ZEBRA_OK);
41     for (i = 1; i <= 2; i++)
42     {
43         sprintf(path, "%.200s/rec%d.xml", tl_get_srcdir(), i);
44         zebra_repository_update(zh, path);
45     }
46     YAZ_CHECK(zebra_end_trans(zh) == ZEBRA_OK);
47     zebra_commit(zh);
48
49     YAZ_CHECK(tl_query(zh, "@attr 5=1 @attr 6=3  @attr 4=1 @attr 1=/assembled/basic/names/CASno \"367-93-1\"", 2));
50
51     YAZ_CHECK(tl_query(zh, "@attr 5=1 @attr 6=3  @attr 4=1 @attr 1=18 \"367-93-1\"", 2));
52
53     YAZ_CHECK(tl_query(zh, "@attr 1=/assembled/orgs/org 0", 1));
54
55     YAZ_CHECK(tl_query(zh,
56              "@and @attr 1=/assembled/orgs/org 0 @attr 5=1 @attr 6=3 @attr 4=1 "
57              "@attr 1=/assembled/basic/names/CASno \"367-93-1\"", 1));
58
59     YAZ_CHECK(tl_query(zh,
60              "@and @attr 1=/assembled/orgs/org 1 @attr 5=1 @attr 6=3  @attr 4=1 "
61              "@attr 1=/assembled/basic/names/CASno 367-93-1", 2));
62
63     /* bug #317 */
64     YAZ_CHECK(tl_query(zh, "@attr 1=1010 46", 2));
65
66     /* bug #431 */
67     YAZ_CHECK(tl_query(zh, "@attr 1=1021 0", 1));
68
69     /* bug #431 */
70     YAZ_CHECK(tl_query(zh, "@attr 1=1021 46", 1));
71
72     /* bug #431 */
73     YAZ_CHECK(tl_query(zh, "@attr 1=1021 1", 0));
74
75     /* bug #460 */
76     YAZ_CHECK(tl_query(zh, "@attr 1=4 46", 0));
77
78     /* bug #460 */
79     YAZ_CHECK(tl_query(zh, "@attr 1=4 beta", 1));
80
81     YAZ_CHECK(tl_close_down(zh, zs));
82 }
83
84 TL_MAIN
85 /*
86  * Local variables:
87  * c-basic-offset: 4
88  * c-file-style: "Stroustrup"
89  * indent-tabs-mode: nil
90  * End:
91  * vim: shiftwidth=4 tabstop=8 expandtab
92  */
93