1 /* This file is part of the Zebra server.
2 Copyright (C) 1994-2009 Index Data
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
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
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
20 #include "../api/testlib.h"
22 static void tst(int argc, char **argv)
25 ZebraService zs = tl_start_up(0, argc, argv);
26 ZebraHandle zh = zebra_open(zs, 0);
29 YAZ_CHECK(zebra_select_database(zh, "Default") == ZEBRA_OK);
33 tl_check_filter(zs, "grs.xml");
35 zebra_set_resource(zh, "recordType", "grs.xml");
37 YAZ_CHECK(zebra_begin_trans(zh, 1) == ZEBRA_OK);
38 for (i = 1; i <= 2; i++)
40 sprintf(path, "%.200s/rec%d.xml", tl_get_srcdir(), i);
41 zebra_repository_update(zh, path);
43 YAZ_CHECK(zebra_end_trans(zh) == ZEBRA_OK);
46 YAZ_CHECK(tl_query(zh, "@attr 5=1 @attr 6=3 @attr 4=1 @attr 1=/assembled/basic/names/CASno \"367-93-1\"", 2));
48 YAZ_CHECK(tl_query(zh, "@attr 5=1 @attr 6=3 @attr 4=1 @attr 1=18 \"367-93-1\"", 2));
50 YAZ_CHECK(tl_query(zh, "@attr 1=/assembled/orgs/org 0", 1));
52 YAZ_CHECK(tl_query(zh,
53 "@and @attr 1=/assembled/orgs/org 0 @attr 5=1 @attr 6=3 @attr 4=1 "
54 "@attr 1=/assembled/basic/names/CASno \"367-93-1\"", 1));
56 YAZ_CHECK(tl_query(zh,
57 "@and @attr 1=/assembled/orgs/org 1 @attr 5=1 @attr 6=3 @attr 4=1 "
58 "@attr 1=/assembled/basic/names/CASno 367-93-1", 2));
61 YAZ_CHECK(tl_query(zh, "@attr 1=1010 46", 2));
64 YAZ_CHECK(tl_query(zh, "@attr 1=1021 0", 1));
67 YAZ_CHECK(tl_query(zh, "@attr 1=1021 46", 1));
70 YAZ_CHECK(tl_query(zh, "@attr 1=1021 1", 0));
73 YAZ_CHECK(tl_query(zh, "@attr 1=4 46", 0));
76 YAZ_CHECK(tl_query(zh, "@attr 1=4 beta", 1));
78 YAZ_CHECK(tl_close_down(zh, zs));
85 * c-file-style: "Stroustrup"
86 * indent-tabs-mode: nil
88 * vim: shiftwidth=4 tabstop=8 expandtab