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 /** xpath1.c - index a simple sgml record and search in it */
24 static void tst(int argc, char **argv)
28 const char *myrec[] = {
38 zs = tl_start_up(0, argc, argv);
39 zh = zebra_open(zs, 0);
40 YAZ_CHECK(tl_init_data(zh, myrec));
42 YAZ_CHECK(tl_query(zh, "@attr 1=/sgml/tag before", 0));
43 YAZ_CHECK(tl_query(zh, "@attr 1=/sgml/tag inside", 1));
44 YAZ_CHECK(tl_query(zh, "@attr 1=/sgml/tag {inside it}", 1));
45 YAZ_CHECK(tl_query(zh, "@attr 1=/sgml/tag after", 0));
47 YAZ_CHECK(tl_query(zh, "@attr 1=/sgml/none after", 0));
48 YAZ_CHECK(tl_query(zh, "@attr 1=/sgml/none inside", 0));
50 YAZ_CHECK(tl_query(zh, "@attr 1=/sgml before", 1));
51 YAZ_CHECK(tl_query(zh, "@attr 1=/sgml inside", 1));
52 YAZ_CHECK(tl_query(zh, "@attr 1=/sgml after", 1));
54 YAZ_CHECK(tl_query(zh, "@attr 1=/sgml/tag/@x v", 1));
55 YAZ_CHECK(tl_query(zh, "@attr 1=/sgml/tag/@x no", 0));
56 YAZ_CHECK(tl_query(zh, "@attr 1=/sgml/tag/@y v", 0));
58 YAZ_CHECK(tl_query(zh, "@attr 1=_XPATH_BEGIN @attr 4=3 tag/sgml/", 1));
59 YAZ_CHECK(tl_query(zh, "@attr 1=_XPATH_BEGIN @attr 4=3 sgml/", 1));
60 YAZ_CHECK(tl_query(zh, "@attr 1=_XPATH_BEGIN @attr 4=3 tag/", 0));
63 YAZ_CHECK(tl_query(zh, "@attr 1=/sgml/tag @attr 2=103 dummy", 1));
64 YAZ_CHECK(tl_query(zh, "@attr 1=/sgml @attr 2=103 dummy", 1));
65 YAZ_CHECK(tl_query(zh, "@attr 1=/tag @attr 2=103 dummy", 0));
66 YAZ_CHECK(tl_query(zh, "@attr 1=/sgml/tag/@x @attr 2=103 dummy", 1));
67 YAZ_CHECK(tl_query(zh, "@attr 1=/sgml/tag/@y @attr 2=103 dummy", 0));
69 YAZ_CHECK(tl_close_down(zh, zs));
76 * c-file-style: "Stroustrup"
77 * indent-tabs-mode: nil
79 * vim: shiftwidth=4 tabstop=8 expandtab